function ShowDn(num,nav,button,withwidget){
//alert(withwidget);
document.images[button].src=eval(nav+'_button_dn['+num+'].src');
if(withwidget !== ''){
//alert('fff'+withwidget+'ff');
	//document.images['widget0'].src= widget_dn[withwidget].src;
	document.images['widget' + num].src = widget_dn[withwidget].src;
}

}
function ShowUp(num,nav,button,withwidget){
document.images[button].src=eval(nav+'_button_up['+num+'].src');
if(withwidget  !== ''){
	document.images['widget' + num].src = widget_up[withwidget].src;
}
}


	 var cwin = null;
	 function openWin(theUrl, name, width, height, tools) {
	   cwin = window.open('', name,
	  tools+'width=' + width + ',height='+height);
	  if (cwin != null) {
	   if (cwin.opener == null)
	    cwin.opener = self;
	   cwin.location.href= theUrl;
	
	    cwin.focus();
	  }
	 }
	 function closeWin(theWin) {
	  theWin.close();
	 }
function show(object) 
  {
  if(navigator.vendor && navigator.vendor.indexOf("Apple") >=0){
  document.getElementById(object).style.display = 'inline-block';
  }else{
  document.getElementById(object).style.display = 'block';
  }
   
   document.getElementById(object).style.visibility = 'visible';
 
  }
           
 function hide(object) 
  {
  
   document.getElementById(object).style.display = 'none';
   document.getElementById(object).style.visibility = 'hidden';

  }
  function isEMailAddress(str)
{
		return isValidText(str,"^([\\w\\._-]+)@([\\w_-]+\\.)+([\\w_]+)$");
}







function isValidText(str,regex)
{
	if (window.RegExp){
		if (typeof(regex)=='string')
			regex=new RegExp(regex);
		return regex.test(str);
	}else{
		window.alert("RegExp not available!");
		return true;
	}
}

function SetActive(butt_num,butt_name){
	main_nav_button_up[butt_num]=new Image();
	main_nav_button_up[butt_num].src = 'media/nav/' + main_nav_buttons_name[butt_num] + '_dn.gif';
	document.images[butt_name].src='media/nav/' + main_nav_buttons_name[butt_num] + '_dn.gif';
}

function ShowSub(menuid,status){
	if(document.getElementById(menuid)){
		nav_list = new Array('why','catalog','how','faq');
		
		//hides all navs then shows the current one
		for(x=0;x < nav_list.length ;x++){
		
			if(document.getElementById(nav_list[x]+'nav')){
				subnav = document.getElementById(nav_list[x]+'nav');
				subnav.style.display='none';
			
			}
		}
		
				if(document.getElementById)
				{
					menu=document.getElementById(menuid);
					menu.style.display=(status)?'block':'none';
					menu.style.visibility=(status)?'visible':'hidden';
				}
		
		
	}
}


function ServiceItemChange(id,num,bgcolor,color){
if(document.getElementById(id)){
	//alert(document.getElementById(id+'a'));
	if(num){
	//document.getElementById(id+'_img').src='media/buttons/dropdowns/'+bgcolor+'_dn.gif';
	document.getElementById(id).style.backgroundColor ='#666666';
		//alert(document.getElementById(id+'_img').src);
		//document.getElementById(id).style.cursor = 'hand';
		//if(document.getElementById(id+"a")){
		//	document.getElementById(id+"a").style.backgroundColor=bgcolor;
		// }
	
	}else{
	//document.getElementById(id+'_img').src='media/buttons/dropdowns/'+bgcolor+'_up.gif';
		//document.getElementById(id).style.backgroundColor=color;
		document.getElementById(id).style.backgroundColor ='#CCCCCC';
			// document.getElementById(id).style.cursor = 'auto';
		//if(document.getElementById(id+"a")){
		//	document.getElementById(id+"a").style.backgroundColor=color;
		//}
	
	}
	
}
}

function CalcPos(ishome){
nav_list = new Array('why','catalog','how','faq');


	for(x=0;x < nav_list.length ;x++){
	
		//calculate the position of the subnavs
		subnav = document.getElementById(nav_list[x]+'nav');
		thespan = document.getElementById(nav_list[x]+'span');
	
	
	if(nav_list[x] == 'community' || nav_list[x] == 'chamber'){
		subnav.style.left=thespan.offsetLeft - 147;
		subnav.style.top=thespan.offsetTop;
		//objectdump(positioner);
	}else{
		subnav.style.left=thespan.offsetLeft-6;
		if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
	   && (navigator.appVersion.indexOf("Win") != -1) ){
			subnav.style.top=thespan.offsetTop+10;
		}else if(navigator.vendor.indexOf("Apple") >=0){
			subnav.style.top=thespan.offsetTop+10;
		}else{
			subnav.style.top=thespan.offsetTop;
		}
		//subnav.style.top=thespan.offsetTop+26;
	
	
	
	}
	
	if(ishome){
		if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
	   && (navigator.appVersion.indexOf("Win") != -1) ){
			subnav.style.top=thespan.offsetTop+11;
		}else if(navigator.vendor.indexOf("Apple") >=0){
			subnav.style.top=thespan.offsetTop+10;
		}else{
			subnav.style.top=thespan.offsetTop;
		}
	}
//subnav.style.top=thespan.style.top;

}



}

