// JavaScript Document



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; }
}

function MM_effectBlind(targetElement, duration, from, to, toggle)
{
	Spry.Effect.DoBlind(targetElement, {duration: duration, from: from, to: to, toggle: toggle});
}


function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}
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_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_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_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 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+"'");
  }
}




function disp_mail(D,A,MA1,MA2) {
  var ML1 = "mai" + "lto:" + A + "&#64;" + D;
  //return "<a href=\"" + ML1 + "\" " + ">" +  MA1 + MA2 + "</a>";
  
  document.write("<a href=\"" + ML1 + "\" ");
  document.write(">" +  MA1 + MA2 + "</a>");
}

function ajaxRequest(URL,output_id) {
	var xmlHttp;
	try {
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e) {
		// Internet Explorer
		try {
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e) {
			try {
				xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e) {
				alert("Your browser does not support AJAX");
				return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function() {
		if(xmlHttp.readyState==4) {
			document.getElementById(output_id).innerHTML=xmlHttp.responseText;
		}
    }
	xmlHttp.open("GET",URL,true);
	xmlHttp.send(null);
}

function removeSpaces(string) {
	return string.split(' ').join('');
}

function IsNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }


function replace_content(content,output_id) {
	document.getElementById(output_id).innerHTML=content;
}

function append_content(content,output_id) {
	document.getElementById(output_id).innerHTML += content;
}

function create_hidden_form_variable(name,value) {
	
	return "<input type=\"hidden\" name=\"" + name + "\" type=\"hidden\" value=\"" + encodeURIComponent(value) +  "\" />"

}

function disable_radio_group(radio_group_name) {
	var thisradiogroup = document.getElementsByName(radio_group_name);
	for(var i=0;i<thisradiogroup.length;i++) {
		thisradiogroup[i].disabled = true;
	} 
}

function disable_item(item_name) {
	var thiselement = document.getElementsByName(item_name);
	thiselement[0].disabled = true;
}

function enable_item(item_name) {
	var thiselement = document.getElementsByName(item_name);
	thiselement[0].disabled = false;
}

function appear_item(item_name) {
	var thiselement = document.getElementsByName(item_name);
	thiselement[0].style.visibility = 'visible';
}

function disappear_item(item_name) {
	var thiselement = document.getElementsByName(item_name);
	thiselement[0].style.visibility = 'hidden';
}

function display_item(item_name,display_val,type) {
	if(type == 'id') {
		var thiselement = document.getElementById(item_name);
		thiselement.style.display = display_val;		
	} else if (type == 'name') {
		var thiselement = document.getElementsByName(item_name);
		thiselement[0].style.display = display_val;
	}
	
}

