// ------------------------------------------------------------------

	url = document.location.href;
	xend = url.lastIndexOf("/") + 1;
	rootURL = url.substring(0, xend);
	var slide_show_active = 0; 	//slide show starts in off
	var curr_pic = 0;
	var txt_size = 1;
	
// ------------------------------------------------------------------

	function turnOn(imgName) {
		if (document.images) {
			document[imgName].src = eval(imgName + 'on.src');
		}
	}

// ------------------------------------------------------------------

	function turnOff(imgName) {
		if (document.images) {
			document[imgName].src = eval(imgName + 'off.src');
		}
	}

// ------------------------------------------------------------------

	function funnel_win(theURL,winName,width,height) {
		var myWin = window.open(theURL,winName,'width=' + width + ',height=' + height + ',top=' + (screen.height-height)/2 + ',left=' + (screen.width-width)/2 + ',scrollbars=yes');
	}

// ------------------------------------------------------------------

	function MM_findObj(n, d) { //v4.01
	 var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	   d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	 if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	 for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	 if(!x && d.getElementById) x=d.getElementById(n); return x;
	}

// ------------------------------------------------------------------

	function MM_showHideLayers() { //v3.0 (id, null, 'show/hide')
	  var i,p,v,obj,args=MM_showHideLayers.arguments;
	  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
	    obj.visibility=v; }
	}
	function MM_swapImgRestore() { //v3.0
	  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}
	function MM_preloadImages() { //v3.0
	  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}
	function MM_swapImage() { //v3.0
	  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}

// ------------------------------------------------------------------

	function enlargeRuler() {
		minPageHeight = 287;
		minRulerHeight = 0;
		if (document.layers) {
			if (window.innerHeight > minPageHeight) document.images['ruler'].height = (window.innerHeight - minPageHeight) + minRulerHeight;
		}
		else if (document.documentElement.clientHeight > 0) {
			if (document.documentElement.clientHeight > minPageHeight) document.images['ruler'].height = (document.documentElement.clientHeight - minPageHeight) + minRulerHeight;
		}
		else {
			if (document.body.clientHeight > minRulerHeight) document.images['ruler'].height = (document.body.clientHeight - minPageHeight) + minRulerHeight;
		}
	}

// ------------------------------------------------------------------

	function myRuler() {
		minPageHeight = 287;
		minRulerHeight = 0;
		if (document.layers) document.write ('<img src=\"' + rootURL + 'pub/images/dot.gif\" width=\"1\" height=\"'+((window.innerHeight > minPageHeight) ? (window.innerHeight - (minPageHeight + 10)) + minRulerHeight : 1)+'\" name=\"ruler\">');
			else document.write ('<img src=\"' + rootURL + 'pub/images/dot.gif\" width=\"1\" height=\"1\" name=\"ruler\">');
	}

// ------------------------------------------------------------------

	function changePic(pic_id){
		document.getElementById('main_img').src = pic_id;
	}

// ------------------------------------------------------------------

	function toggleIt(id) {
		var f = document.getElementById(id);
		if (f.style.display=='block') {
			f.style.display='none';
		}
		else
		{
			f.style.display='block';
		}
	}

// ------------------------------------------------------------------



	function slideShow(block_id, id, speed, action_id, autoRotate){

		var imgblocks = document.getElementsByName('bttn_ss_'+block_id);
		var imgButtons = document.getElementsByName('tween_'+block_id);
		var state = document.getElementById('slide_show_state_'+block_id);
		var counter;
		counter = id;
		var run = 0;
	   
	
    //autoRotate if applicable
	if (autoRotate == 1){  run = setInterval('rotate()', speed*1000);}	
	
	//move the last item before first item, just in case user click prev button   
    $('.slideshow_table .slidetable').hide();
    $('.slideshow_table .slidetable:first-child').show();
    //$('.slideshow_table .slidetable:first').show().before($('.slideshow_table .slidetable:last'));   
            
	
       
    $('.next').click(function() {   
        clearInterval(run); 
			if ($('.slideshow_table .slidetable:last-child').is(':visible')) {
				 $('.slideshow_table .slidetable:visible').fadeOut('slow',function(){
					$('.slideshow_table .slidetable:first-child').fadeIn('slow');  
				 });
			}
			else{

				 $('.slideshow_table .slidetable:visible').fadeOut('slow',function(){
				 jQuery(this).next().fadeIn('slow');  
				 })
			}
			if (autoRotate == 1){  run = setInterval('rotate()', speed*1000);}	
        return false;              
    }); 
	   
	   
    $('.prev').click(function() {   
			clearInterval(run); 
			if ($('.slideshow_table .slidetable:first-child').is(':visible')) {
				 $('.slideshow_table .slidetable:visible').fadeOut('slow',function(){$('.slideshow_table .slidetable:last-child').fadeIn('slow');  });
				 
			}
			else{
				 $('.slideshow_table .slidetable:visible').fadeOut('slow',function(){
					jQuery(this).prev().fadeIn('slow');
				 });  
			}	
				if (autoRotate == 1){  run = setInterval('rotate()', speed*1000);}							  
        return false;              
    }); 	   
      

    //if mouse hover, pause the auto rotation, otherwise rotate it   
    $('.slideshow_table').hover(        
        function() {   
            clearInterval(run);   
        },    
        function() { 
			clearInterval(run);  
           	if (autoRotate == 1){  run = setInterval('rotate()', speed*1000);}	
        }   
    );  	  
	  
	}

	function rotate() {   
  
    			if ($('.slideshow_table .slidetable:last-child').is(':visible')) {
				 $('.slideshow_table .slidetable:visible').fadeOut('slow', function(){
					$('.slideshow_table .slidetable:first-child').fadeIn('slow');  
				 });
				 
			}
			else{
				 $('.slideshow_table .slidetable:visible').fadeOut('slow',function(){
				 jQuery(this).next().fadeIn('slow');  
				 });
			}  
	}	



// ------------------------------------------------------------------

	function slideit(block_id, id){
		/*var imgblocks = document.getElementsByName('bttn_ss_'+block_id);
		if (imgblocks[0].value == 'Start Slide Show') {
		if (document.getElementById('slide_show_bttn').value == 'Stop Slide Show') {
			moveNext(block_id, id);
			setTimeout("slideit("+block_id+","+(Number(id)+1)")", 3000);
		}*/
	}

// ------------------------------------------------------------------

	function chngImg(block_id, id, action_id) {

	}

// ------------------------------------------------------------------

	function expandCollapseMenu() {
		var aMcurrentState = document.getElementById('ab0_1').style.display;
		if (aMcurrentState == 'none') {
			for (i = 1; i <= 9; i++) {
				document.getElementById('ab0_'+i).style.display = '';
			}
		}
		else {
			for (i = 1; i <= 9; i++) {
				document.getElementById('ab0_'+i).style.display = 'none';
			}
		}
		return false;
	}

// ------------------------------------------------------------------

	function moveDualList(srcList, destList) {
		var moveAll = false;
		if ((srcList.selectedIndex == -1) && (moveAll == false)) {
		    return false;
		}
		newDestList = new Array( destList.options.length );

		var len = 0;
		for( len = 0; len < destList.options.length; len++ ) {
			if ( destList.options[ len ] != null ) {
				newDestList[ len ] = new Option( destList.options[len].text, destList.options[ len ].value, destList.options[ len ].defaultSelected, destList.options[ len ].selected );
			}
		}

		for( var i = 0; i < srcList.options.length; i++ ) {
			if ( srcList.options[i] != null && ( srcList.options[i].selected == true || moveAll ) ) {
				newDestList[ len ] = new Option( srcList.options[i].text, srcList.options[i].value, srcList.options[i].defaultSelected, srcList.options[i].selected );
				len++;
			}
		}
		var tmp;
		for ( var j = 0; j < newDestList.length; j++ ) {
			if ( newDestList[ j ] != null ) {
				destList.options[ j ] = newDestList[ j ];
			}
		}
		for( var i = srcList.options.length - 1; i >= 0; i-- ) {
			if ( srcList.options[i] != null && ( srcList.options[i].selected == true || moveAll ) ) {
				srcList.options[i]       = null;
		   }
		}
		for (var i = 1; i < destList.options.length; i++ ) {
			for (var j = i; j < destList.length; j++ ) {
				if (destList.options[j-1].text > destList.options[j].text) {
					var tmp = destList.options[j].text;
					destList.options[j].text = destList.options[j-1].text;
					destList.options[j-1].text = tmp;

					tmp = destList.options[j].value;
					destList.options[j].value = destList.options[j-1].value;
					destList.options[j-1].value = tmp;

					tmp = destList.options[j].selected;
					destList.options[j].selected = destList.options[j-1].selected;
					destList.options[j-1].selected = tmp;
				}
			}
		}
		return false;
	}

//------------------------------------------------------------------
/* Function is sent an element ID for the object which will have 
/		it's font size changed, and the size to change it to.
/		Note: Line Height is also changed
*/
  function changeFontSize(elementID, size){
		
		// If the size is sent a string rather than a number, change the font size in increments
		if (typeof(size) == "string") {
			if (size == 'smaller') {
				txt_size = txt_size - 0.1;
			}
			else if (size == 'larger') {
				txt_size = txt_size + 0.1;
			}
			else {
				txt_size = 1;
			}
			document.getElementById(elementID).style.fontSize = txt_size + 'em';
			document.getElementById(elementID).style.lineHeight = "normal";/*txt_size + 0.2 + 'em';*/
		}
		else {
			if (elementID != 0) { 
				document.getElementById(elementID).style.fontSize = size +'em'; 
				document.getElementById(elementID).style.lineHeight = "normal";/*size + 0.2 + 'em';*/
			}
			else { 
				document.body.style.fontSize = size +'em'; 
				document.getElementById(elementID).style.lineHeight = "normal";/*size + 0.2 + 'em';*/
			}
		}
  }

// ------------------------------------------------------------------

	function validateBlogComment() {
		var oForm = document.commentForm;
		oErrMsg.initErrMsgs();
		chkEmptyFld(oForm.txt_name, 'Name');
		chkValidEmail(oForm.txt_email, 'Email Address');
		if (document.getElementById('Captcha_Security_Code')) { chkEmptyFld(oForm.Captcha_Security_Code, 'Security Code'); }
		
		if (oErrMsg.errMsgAdded == true) {
			oErrMsg.dispErrMsgs();
			oErrMsg.focusFirst();
			return false;
		}
		else {
			return true;
		}
	}


	function checkTxtaLength(theField, theLimit) {
		if (theField.value.length > theLimit) { theField.value = theField.value.substring(0, theLimit);	} 
	}

// ------------------------------------------------------------------
