function swapPic() 
	 { 
	 	if(document.getElementById) 
	   	{ 
		   	var thePicture=document.getElementById("rotate"); 
		   	var picPath="_images/rotate/pic"+rnd(4)+".jpg"; 
		   	thePicture.style.background="url("+picPath+")"; 
		} 
	 } 
  
//-----------------------------------------------------------------------  
  
	function rnd(n) 
	 { 
	 	return Math.floor(Math.random() * n) + 1; 
	 } 
  
//-----------------------------------------------------------------------  
  
	var newwin;
	var winurl;
	var winname;
	var winfeatures;
	
	function popSlideShow(page) 
		{	
			winurl		= page; //"/Campaign_Preview.asp?lngPageID=" + page;
			winname		= "Preview";
			winfeatures = "height=415,width=700,location=no,scrollbars=no,menubars=no,toolbars=no,status=no,resizable=no,screenX=0,screenY=0";
			newwin = window.open(winurl, winname, winfeatures);
//			if(javascript_version > 1.0)
//			{
//				//delay a bit here because IE4 encounters errors when trying to focus a recently opened window
//		 		setTimeout('newwin.focus();',250);
//			}
		}
  
//-----------------------------------------------------------------------  
  	
	function PopupAnimation(file) 
		{
			var windowHandle;
			var winl = (screen.width - 406) / 2;
			var wint = (screen.height - 276) / 2;
		
			windowHandle = window.open(file,'Animation','width=406,height=276,location=no,scrollbars=0,top=' + wint + ',left=' + winl); 
			windowHandle.focus()
		}
  
//-----------------------------------------------------------------------  
  
	function toggleOff(idname) {
		document.getElementById(idname).style.display = 'none';
		}
  
//-----------------------------------------------------------------------  
  				
	function toggleOn(idname) {
		document.getElementById(idname).style.display = 'block';
		}	
  
//-----------------------------------------------------------------------  
  	
	function isValidEmail(str) {
		return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
 		}
  
//-----------------------------------------------------------------------  
  	
	function IsEmpty(aTextField) {
   		if ((aTextField.value.length==0) ||
   			(aTextField.value==null)) {
      		return true;
   		}
   		else { return false; }
		}		
  
//-----------------------------------------------------------------------  
  	
	function IsNumeric(sText)
		{
   			var ValidChars = "0123456789.";
   			var IsNumber=true;
   			var Char;

   			for (i = 0; i < sText.length && IsNumber == true; i++) 
      			{ 
      				Char = sText.charAt(i); 
      				if (ValidChars.indexOf(Char) == -1) 
         				{
         					IsNumber = false;
         				}
      			}
   			return IsNumber;
   		}

//=======================================================================================================================

// converts a list to a two column list
function twoCols(src, type)
	{
	var origList = src;
	var leftList = document.createElement(type);
	var rightList = document.createElement(type);
	var container = document.createElement('div');
	
	var items = origList.getElementsByTagName('LI');
	
	var itemsLength = items.length/2;
	for (i = 0; i < itemsLength; i++)
		{
		leftList.appendChild(items[0]);
		}
		
	itemsLength = items.length;
	for (i = 0; i < itemsLength; i++)
		{
		rightList.appendChild(items[0]);
		}
	container.appendChild(leftList);
	container.appendChild(rightList);
	
	leftList.setAttribute('class', 'left');
	rightList.setAttribute('class', 'right');
	if (type == 'ol')
		{
		rightList.setAttribute('start', leftList.getElementsByTagName('LI').length + 1 );
		}
	container.setAttribute('class','twocol');
	if (document.all)
		{
		// ugly hack for ie win
		leftList.setAttribute('className', 'left');
		rightList.setAttribute('className', 'right');
		container.setAttribute('className','twocol');
		}
	origList.parentNode.replaceChild(container, origList);
	}
function allTwoCols (whichclass, type)
	{
	var uls = document.getElementsByTagName(type);
	for (var i=0; i< uls.length; i++)
		{
		if (uls[i].getAttribute('class') == whichclass || uls[i].getAttribute('className') == whichclass)
			{
			twoCols(uls[i], type.toLowerCase());
			}
		}
	}

//=======================================================================================================================

sfHover = function() {
	var sfEls = document.getElementById("nav").getElementsByTagName("li");
	for (var i=0; i<sfEls.length; i++) {
		sfEls[i].onmouseover=function() {
			this.className+=" sfhover";
	
	        if(document.getElementById("menu_iframe1")) {
				var iframe = document.getElementById("menu_iframe1");

				var submenu = this.getElementsByTagName("ul");
				if(submenu.length) {
					iframe.style.top = submenu[0].offsetTop + this.offsetTop + 78;
					iframe.style.left = submenu[0].offsetLeft + this.offsetLeft;
					iframe.style.width = submenu[0].scrollWidth + 2;
					iframe.style.height = submenu[0].clientHeight;
					iframe.style.display = "inline";
				}
			}
			if(document.getElementById("menu_iframe2")) {
				var iframe2 = document.getElementById("menu_iframe2");

				var submenu2 = this.getElementsByTagName("ul");
				if(submenu2.length) {
					iframe2.style.top = submenu2[1].offsetTop + this.offsetTop + 139;
					iframe2.style.left = submenu2[1].offsetLeft + this.offsetLeft + 1;
					iframe2.style.width = submenu2[1].scrollWidth + 2;
					iframe2.style.height = submenu2[1].clientHeight + 1;
					iframe2.style.display = "inline";
				}
			}	
		}
		sfEls[i].onmouseout=function() {
			this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
			
	        if(document.getElementById("menu_iframe1")) {
				var iframe = document.getElementById("menu_iframe1");
				iframe.style.display = "none";
			}
			if(document.getElementById("menu_iframe2")) {
				var iframe2 = document.getElementById("menu_iframe2");
				iframe2.style.display = "none";
			}
		}
	}
}
if (window.attachEvent) window.attachEvent("onload", sfHover);

//=======================================================================================================================

function scroll_me(flag)
{
	document.getElementById(flag).className='current';
	document.location="#" + flag;
}

//=======================================================================================================================

function setBackgroundImage (elementID, imgURL) {
  if (document.all)
    document.all[elementID].style.backgroundImage = 'url(' + imgURL + 
')';
  else if (document.getElementById)
    document.getElementById(elementID).style.backgroundImage = 'url(' + 
imgURL + ')';
}

//=======================================================================================================================

function MM_CheckFlashVersion(reqVerStr,msg){  with(navigator){    var isIE  = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);    var isWin = (appVersion.toLowerCase().indexOf("win") != -1);    if (!isIE || !isWin){        var flashVer = -1;      if (plugins && plugins.length > 0){        var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";        desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;        if (desc == "") flashVer = -1;        else{          var descArr = desc.split(" ");          var tempArrMajor = descArr[2].split(".");          var verMajor = tempArrMajor[0];          var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");          var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;          flashVer =  parseFloat(verMajor + "." + verMinor);        }      }      // WebTV has Flash Player 4 or lower -- too low for video      else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0;      var verArr = reqVerStr.split(",");      var reqVer = parseFloat(verArr[0] + "." + verArr[2]);        if (flashVer < reqVer){        if (confirm(msg))          window.location = "http://www.macromedia.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";      }    }  } }
