// JavaScript Document

function changepic (target, newpic) {

	
	document[target].src = newpic;
}

function MA_changeDiv (divname,myvalue)
{
	
	if ((obj=MM_findObj(divname))!=null) { 
		if (obj.style) 
		{ 
			obj=obj.style; 
			obj.display=myvalue;
		}
  	}  

}

function checkReferral(mychoice)
{
	//alert ('got here');
	
	if (mychoice=="Other: ") {		
		MA_changeDiv('referraldiv','block');
	} else {
		MA_changeDiv('referraldiv','none');		
	}

}


function formtextclear (myfield, defaulttext) {
if (myfield.value == defaulttext) {
myfield.value = "";
}
}


function formtextrecall (myfield, defaulttext) {
if (myfield.value == "") {
myfield.value = defaulttext;
}
}


function get_param( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
} //end get_param


function ma_MoveSpacer (spacing) {  //move the footer spacing on the Portfolio page based on spacing parameter
	
	if ((obj=MM_findObj('portfolio_spacer'))!=null) { 
		if (obj.style) 
		{ 
			obj=obj.style; 
			obj.height=spacing + "px";
		}
  	}  		
	
} // end ma_MoveSpacer


function ma_BrowserCheck() {
	
	if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) { //test for MSIE x.x;
	
		 var ieversion=new Number(RegExp.$1) // capture x.x portion and store as a number
		 var obj;
		 
		 if (ieversion<7) {
			  //alert("You're using an outdated IE browser");
			  if ((obj=MM_findObj('fade_left'))!=null)
			  { 
				if (obj.style) 
				{ 
					obj=obj.style; 
					obj.visibility="hidden";
				}
			  }  
			  if ((obj=MM_findObj('fade_right'))!=null)
			  { 
				if (obj.style) 
				{ 
					obj=obj.style; 
					obj.visibility="hidden";
				}
			  }  
		
		 }
	
	}
} // end ma_BrowserCheck



function ma_HideLayers (pre_txt) { //v1.0 hide all layers of the paramter's name 

	var obj, i;
	
	i=1;
	
	nr = pre_txt + i;
	
   while ((obj=MM_findObj(nr))!=null)
   {
	if (document.layers)
	{document.layers[nr].visibility = 'hide';}
	else if (document.all)
	{document.all[nr].style.visibility = 'hidden';}
	else if (document.getElementById)
	{document.getElementById(nr).style.visibility = 'hidden';}
	
	i++;
	nr = pre_txt + i;

   } //end whileloop

} // end ma_HideLayers


function ma_ShowLayer (showthis) { //show the given layer
	
  var obj;
  
  ma_HideLayers('content');
  
  if ((obj=MM_findObj(showthis))!=null)
  { 
  	if (obj.style) 
  	{ 
		obj=obj.style; 
		obj.visibility='visible';
	}
  }    
	
}  //end ma_ShowLayer




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;
}


// **************** MENU FUNCTIONS *********************

function MM_changeProp(objId,x,theProp,theValue) { //v9.0
  var obj = null; with (document){ if (getElementById)
  obj = getElementById(objId); }
  if (obj){
    if (theValue == true || theValue == false)
      eval("obj.style."+theProp+"="+theValue);
    else eval("obj.style."+theProp+"='"+theValue+"'");
  }
} //end MM_changeProp

function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) 
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}//end MM_showHideLayers


function clear_menu(id) {
	
	document.getElementById(id).style.visibility='hidden';

} //end clear_menu

var a,b,c,d,e;

function timedClear(id)
{

	switch (id) {
	   case 'dropmenu-services': e=setTimeout("clear_menu('dropmenu-services')",400); break;
	}	
} //end timedClear


function clearTimer(id)
{
	switch (id) {
	   case 'dropmenu-services': clearTimeout(e); break;
	}
} //end clearTimer









