//------------------- for clearing and replacing text in form input fields and textareas -------------------//
function clearText(thefield) {
  if (thefield.defaultValue==thefield.value) { thefield.value = "" }
} 
function replaceText(thefield) {
  if (thefield.value=="") { thefield.value = thefield.defaultValue }
}

//------------------- OPEN NEW WINDOW -------------------//

// generic window //
function EZowin(url) { //1.0
  window.open(url,'ezPopUp','width=600, height=510, resizable=0,scrollbars=no,menubar=no,directories=0,status=0,copyhistory=0,minimise=no,maximise=no,left=0,top=0');
}



// Popup Window Start
	// Browser Detection For Popup
	var browserName = navigator.appName
	var browserVersion = navigator.appVersion
	var browserVersionNum = parseFloat(browserVersion)
	
	var floater_open=0
	
	//Special Detect for IE5 sucks
	if (browserName=="Microsoft Internet Explorer"){
	   pos=browserVersion.search('MSIE ');
	   pos=pos+5
	   browserVersion=browserVersion.substr(pos) 
	   browserVersionNum = parseFloat(browserVersion)
	}
	
	if (browserName == "Netscape" && browserVersionNum >= 3.0) { focblur = 'true'; }
	else if (browserName == "Microsoft Internet Explorer" && browserVersionNum >= 5.0) { focblur = 'true'; }
	else { focblur = 'false'; }
	
	
	//-- This function opens the new, empty window named floater.
	function openWindow(windowurl,windowname,withscroll,left,top,width,height) 
	{
		floater_open=1;
		winStats='toolbar=no,location=no,directories=no,menubar=no,';
		winStats+='status=yes,resizable=no,scrollbars='+withscroll+',width='+width+',height='+height;
		if (navigator.appName.indexOf("Microsoft")>=0) {
		   winStats+=',left='+left+',top='+top;
		}
		else{
		   winStats+=',screenX='+left+',screenY='+top;
		}
		floater=window.open(windowurl,windowname,winStats)
	   	if (focblur == 'true') {
	//		floater.focus();
			floater.close();
			floater=window.open(windowurl,windowname,winStats)
		}
	}
// Popup Window End



// Add Bookmark Start
	function addbookmark()
	{
		bookmarkurl="http://www.domain-name.com";
		bookmarktitle="Title of Bookmark Here";
		if(document.all) window.external.AddFavorite(bookmarkurl,bookmarktitle);
	}
// Add Bookmark End


//Flash Embed Script Start
function printFlash(source, width, height, id, bg_color) {
	document.write('<object style="z-index:0px" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" ');
	document.write('width="'+width+'" height="'+height+'" id="'+id+'" align="middle">');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="movie" value="'+source+'" />');
	document.write('<param name="menu" value="false" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="wmode" value="transparent">');
	//document.write('<param name="wmode" value="Opaque">');
	document.write('<param name="bgcolor" value="'+bg_color+'" />');
	document.write('<embed src="'+source+'" menu="false" wmode="transparent" quality="high" bgcolor="'+bg_color+'" width="'+width+'" height="'+height+'" name="'+id+'" align="middle" ');
	document.write('allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}


/* Form Validator
--------------------------------------------
----------------------------------------- */
<!--
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_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+='- '+nm+' must contain an e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += '- '+nm+' is required.\n'; }
  } if (errors) alert('The following error(s) occurred:\n'+errors);
  document.MM_returnValue = (errors == '');
}
//-->





function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}