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 toggleWoggle(){
	
    
	var the_form = window.document.forms[0];
	
	
	for(var i=0; i<the_form.length; i++){
	    var temp = the_form.elements[i].type;

		 if((temp == "radio") && (the_form.elements[i].checked)) 
			 { 
				toggleCriteria(the_form.elements[i].value);
			 }			
     }
		
}

function switchAA(id) {
		form1.sort.value = id;
		form1.submit();
}
	
function MM_goToURL() { 
  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 showMap(sAddress, sZip) {
	var url = "http://maps.yahoo.com/py/maps.py?Pyt=Tmap&newFL=Use+Address+Below&country=us&Get%A0Map=Get+Map&addr=" + sAddress + "&csz=" + sZip;
	winMap = window.open(url,"map","height=725,width=660,scrollbars=yes,titlebar=no,resizable");
}

function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
   var obj = document.layers ? document.layers[szDivID] :
   document.getElementById ?  document.getElementById(szDivID).style :
   document.all[szDivID].style;
   obj.visibility = document.layers ? (iState ? "show" : "hide") :
   (iState ? "visible" : "hidden");
}

function rollOver(iName,iState)
{
      if(document.images)
      {
        document.images[iName].src = eval(iName + '_' + iState + '.src');
		document.images[iName].useMap = eval(iName + '_' + iState + '.useMap');
      }
}

//-------- function used in create user page below here-------------//
function checkForm() {
	formOK = true;
	missing=false;

	for (var i=0;i<form1.elements.length;i++) {
		if (form1.elements[i].value.length < 1) {
			if (!(form1.elements[i].name.indexOf("Fax") >=0)) {
				missing=true;
				break;
			}
		}
	}
	if(missing) {
		alert("Make sure you fill out all fields.");
		formOK=false;
	}

	if ((form1.password.value != form1.password2.value) || form1.password.value.length < 3) {
		alert("Please make sure your password is typed the same in both fields and is at least 3 characters long");
		formOK=false;
	}

	if (form1.ccNumber.value.indexOf("x")>=0) {
		alert("Please enter a valid credit card number");
		formOK=false;
	}

	if (formOK) {
		form1.submit();	
	}
}
//-------- function used in create user page above here-------------//

//-------- function used on Feedback page below here-------------//

function checkFields()
{

    var msg = "Following fields has invalid entries!\n-----------------------------------------\n\n";
    var ok = "yes";

	if (document.forms[0].Email.value.length==0)
	  {
          ok = "no"
          msg = msg + "Please enter your e-mail address\n";
	  }

	if (document.forms[0].Email.value.length>0)
	   {
		i=document.forms[0].Email.value.indexOf("@")
		j=document.forms[0].Email.value.indexOf(".",i)
		k=document.forms[0].Email.value.indexOf(",")
		kk=document.forms[0].Email.value.indexOf(" ")
		jj=document.forms[0].Email.value.lastIndexOf(".")+1
		len=document.forms[0].Email.value.length
		if ((i>0) && (j>(1+1)) && (k==-1) && (kk==-1) && (len-jj >=2) && (len-jj<=3))
			{
			}
	     else
			{
			ok = "no"
			msg = msg + "Please enter an exact Email Address. -- " +
			document.forms[0].Email.value + " is invalid.\n";
			}
	   }

    if (ok == "no")
      {
      alert(msg);
      return false;
      }
return true;
}
//-------- function used on Feedback page above here-------------//

//-------- FORWARDING below here-------------//
function checkLogin()
{
	document.forms[0].action = 'checkLogin.aspx';
	document.forms[0].submit();
}
function logout()
{
	document.forms[0].action = 'do/logout.aspx';
	document.forms[0].submit();
}
function goToSignUp2()
{
	document.forms[0].action = 'signUp2.aspx';
	document.forms[0].submit();
}
//--------FORWARDING above here-------------//

//--------------------AD PAGES JS below here-------------------------------------------//
function getInfo() {
	sideName.innerText=getInfo.arguments[0];
	sidePrice.innerText=getInfo.arguments[1];
	sideDesc.innerText=getInfo.arguments[2];
	calFromTo();
}
function moveIt() {
	if(calshadow.style.visibility=="visible") {
		calshadow.style.visibility="hidden"; 

		if (document.all) {
			calshadow.style.left=window.event.x+document.body.scrollLeft+20;
			calshadow.style.top=window.event.y+document.body.scrollTop-25;	
		} else {
			calshadow.style.left=window.event.x+20;
			calshadow.style.top=window.event.y-25;	
		}
		calshadow.style.visibility="visible"; 
	}
}

function calFromTo() { 
	calshadow.style.visibility="visible";
}

function calOutTo()  { 
	calshadow.style.visibility="hidden"; 
}
//--------------------AD PAGES JS above here-------------------------------------------//

//--------------------editUser JS below here-------------------------------------------//
function checkForm() {
	formOK = true;
	missing=false;

	for (var i=0;i<form1.elements.length;i++) {
		if (form1.elements[i].value.length < 1) {
			if (!(form1.elements[i].name.indexOf("Fax") >=0)) {
				missing=true;
				break;
			}
		}
	}
	if(missing) {
		alert("Make sure you fill out all fields.");
		formOK=false;
	}

	if ((form1.password.value != form1.password2.value) || form1.password.value.length < 3) {
		alert("Please make sure your password is typed the same in both fields and is at least 3 characters long");
		formOK=false;
	}

	if (form1.ccNumber.value.indexOf("x")>=0) {
		alert("Please enter a valid credit card number");
		formOK=false;
	}

	if (formOK) {
		form1.submit();	
	}
}
//--------------------editUser JS below here-------------------------------------------//

//--------------------MAPQUEST functions-------------------------------------------//
function showDirections(sAddress, sCity, sState, sZip) {
	var url = "http://www.mapquest.com/directions/main.adp?2a="+sAddress+"&2c="+sCity+"&2s="+sState+"&2z="+sZip+"&2y=US&cid=lfddlink";
	winMap = window.open(url,"map","height=725,width=800,scrollbars=yes, left=0, top=0, screenX=0, screenY=0, titlebar=no,resizable");
}

function showMap(sAddress, sCity, sState, sZip) {
	var url = "http://www.mapquest.com/maps/main.adp?address="+sAddress+"&city="+sCity+"&state="+sState+"&zipcode="+sZip+"&country=US&cid=lfmaplink";
	winMap = window.open(url,"map","height=725,width=800,scrollbars=yes, left=0, top=0, screenX=0, screenY=0, titlebar=no,resizable");
}
//--------------------  Ranch Page window opener -------------------------------------------//
function openPicture(image){
	if(navigator.appName == "Microsoft Internet Explorer")
	newwindow=window.open (image, 'picViewer', config='height=400, width=600,top=10, left=10, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no');
	else
	newwindow=window.open (image, '_blank', config='height=400, width=600,top=10, left=10, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no');
	
	//newwindow.refresh;
	//var img = "<img src="+image+" border=0>";
	//newwindow.document.write(img);
	newwindow.focus();
	
}
//---------------------Zip Locator   --------------------------------------------------------//
function openZipLocator12(){
	newwindow=window.open ("zipLocator/zip1.aspx", 'ZipLocator', config='height=500, width=400,top=200, left=400, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no');newwindow.focus();
	
	
	
}
function openZipLocator1(){
	newwindow=window.open ("zipLocator/ZipS1.aspx", 'ZipLocator', config='height=500, width=400,top=200, left=400, toolbar=no, menubar=no, scrollbars=no, resizable=no, location=no, directories=no, status=no');newwindow.focus();
	
	
	
}

function targetopener(mylink, closeme, closeonly)
{
if (! (window.focus && window.opener)) return true;
window.opener.focus();
if (! closeonly)window.opener.location.href=mylink.href;
if (closeme)window.close();
return false;
}



