
<!--
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_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_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 StarChecker() {

	if (POST_SUBMIT != 1) return;

	for (i=0;i<document.forms.length;i++) {

		for (y=0;y<document.forms[i].elements.length;y++) {

			curelem = document.forms[i].elements[y];

			if (curelem.className == 'starfield_char') {

				if ((curelem.value.length < 2) || (curelem.value == '-')) curelem.className = 'starfield_notcorrect';

			} else

			if (curelem.className == 'starfield_int') {

				if (parseInt(curelem.value) < 1) curelem.className = 'starfield_notcorrect';

			}

		}

	}

}

function SetJSField(Tid,Tvalue) {

	tF = document.getElementById(Tid);

	if ((tF.type == 'radio') || (tF.type == 'checkbox')) {

		if (Tvalue == 1) tF.checked = true; else tF.checked = false;

	} else {

		tF.value = (Tvalue);

	}

}

function FormatMoney(value) {
   result="$ "+Math.floor(value)+".";

   var cents=100*(value-Math.floor(value))+0.5;
   result += Math.floor(cents/10);
   result += Math.floor(cents%10);
   return result;
}

function writeCookie(name, value, hours)
{
  var expire = "";
  if(hours != null)
  {
	expire = new Date((new Date()).getTime() + hours * 3600000);
	expire = "; expires=" + expire.toGMTString();
  }
  document.cookie = name + "=" + escape(value) + expire;
}


function echeck(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){
	   return false
	}

	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
	   return false
	}

	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		return false
	}

	 if (str.indexOf(at,(lat+1))!=-1){
		return false
	 }

	 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		return false
	 }

	 if (str.indexOf(dot,(lat+2))==-1){
		return false
	 }
	
	 if (str.indexOf(" ")!=-1){
		return false
	 }

	 return true					
}

function formatNumber(num,dec,thou,pnt,curr1,curr2,n1,n2) {
	var x = Math.round(num * Math.pow(10,dec));
	
	if (x >= 0) n1=n2='';
	
	var y = (''+Math.abs(x)).split('');
	var z = y.length - dec;
	y.splice(z, 0, pnt);
	
	while (z > 3) {
		z-=3; 
		y.splice(z,0,thou);
	}
	
	var r = curr1+n1+y.join('')+n2+curr2;
		
	return r;
}

function winlocation(url) {
	   location = url;
}

function SetHighlighted(object) {
	object.className = 'button_hover';
}

function UnSetSetHighlighted(object) {
	object.className = 'button';
}

function printPreview(url,DefaultWidth,DefaultHeight) {

	var DefaultWidth = (DefaultWidth == null) ? 580 : DefaultWidth;
	var DefaultHeight = (DefaultHeight == null) ? DefaultWidth-200 : DefaultHeight;
	var winl = (screen.width - DefaultWidth) / 2;
	var top = (screen.height - DefaultHeight) / 2;
	
	Width = DefaultWidth;
	Height = DefaultHeight;

	if (DefaultWidth > screen.width) {
		Width = screen.width;
	}
	
	if (Height > screen.height) {
		Height = screen.height;
	}
	
	preview = window.open(url, 'printPreviewwindow','width='+Width+',height='+Height+',top='+top+',left='+winl+',toolbar=no,menubar=yes,dependent=yes,resizable=yes,scrollbars=yes');
	preview.focus();
}

function allDigits(str)
{
	return inValidCharSet(str,"0123456789");
}

function inValidCharSet(str,charset)
{
	var result = true;

	// Note: doesn't use regular expressions to avoid early Mac browser bugs	
	for (var i=0;i<str.length;i++)
		if (charset.indexOf(str.substr(i,1))<0)
		{
			result = false;
			break;
		}
	
	return result;
}

function SelectItemByValue(select_box,item_) {
	var whichitem = 0;
	if (document.getElementById(select_box) == null) return;
	while (whichitem < document.getElementById(select_box).length) {
		if (document.getElementById(select_box).options[whichitem].value == item_) {
			document.getElementById(select_box).selectedIndex = whichitem; 
			break;
		}
		whichitem++;
	}
}

function SelectItem(select_box,item_) {
	var whichitem = 0;
	if (document.getElementById(select_box) == null) return;
	while (whichitem < document.getElementById(select_box).length) {
		if (document.getElementById(select_box).options[whichitem].text == item_) {
			document.getElementById(select_box).selectedIndex = whichitem; 
			break;
		}
		whichitem++;
	}
}

function ChangeStates(obCountry) {
		if((obCountry.id == 'country_b')||(obCountry.id == 'm_country')){
			div = "div_state_b";
			div_us = "div_us_state_b";
		} else {
			div = "div_state";
			div_us = "div_us_state";
		}
		
		if(obCountry.options[obCountry.selectedIndex].value == 'US') {
			document.getElementById(div).style.display = "none";
			document.getElementById(div_us).style.display = "block";
		} else {
			document.getElementById(div).style.display = "block";
			document.getElementById(div_us).style.display = "none";
		}
	}

function CheckSearchValues() {
	if (document.search_form.q.value.length < 3) {
		alert('Enter at least 3 Symbols to search for!');
		return false;
	} else return true;
}