var xmlhttp;
var qaction;

function goback() {
	document.getElementById('Step2').style.display = "none";
	document.getElementById('Step3').style.display = "none";
	document.getElementById('Step1').style.display = "block";
}
function login(temp) {
	if (temp=='register') 
	{
	qaction='register';
	}
	else
	{
	qaction='signin';
	}
}
function emailcheck(mailaddy) {
	if ((mailaddy.indexOf("@")!=-1) && (mailaddy.indexOf(".")!=-1)) {
	return true;
	}
	else {
	alert("We're sorry, but it appears we couldn't validate your email address. Please check it and try again.")
	return false;
	}
}
function passcheck(pass) {
	if (pass.length > 4) {
		return true;
	}
	if (pass.length == 0) {
		alert("Please ensure you've entered your password and try again.")
		return false;
	}
	else {
		alert("Password must be at least 5 characters in length. Please check it and try again.")
		return false;
	}
}
function namescheck(first, last) {
	if (first.length > 0 & last.length > 0) {
		return true;
	}
	if (first.length == 0 || last.length == 0) {
		alert("Please ensure you've entered your first and last name and try again.")
		return false;
	}
}
function passremind(pass) {
	document.getElementById('Step1').style.display = "none";
	document.getElementById('Step2').style.display = "none";
	document.getElementById('Step3').style.display = "block";
}
function java_login_off() {
    new Effect.Fade(document.getElementById('folio_reg_open'));
    document.getElementById("ZipSearch_specialty_on").style.display="block";
    document.getElementById("ZipSearch_specialty_off").style.display="none";
	document.getElementById("div_span").style.visibility = "hidden";
}
function drag(){ Drag.init(document.getElementById("folio_reg_open"));}

var action='';
function java_login() {
    new Effect.Appear(document.getElementById('folio_reg_open'));
    document.getElementById("folio_reg_open").style.top = "20px";
    document.getElementById("folio_reg_open").style.left = "20px";
    document.getElementById("div_span").style.visibility = "visible";
    document.getElementById("ZipSearch_specialty_off").style.display="block";
    document.getElementById("ZipSearch_specialty_on").style.display="none";
    if (action == 'coupons') {
	    document.getElementById("reg_text").style.display="none";
	    document.getElementById("reg_text_coupon").style.display="block";
    }
    else {
	    document.getElementById("reg_text_coupon").style.display="none";
	    document.getElementById("reg_text").style.display="block";
    }
}
//temp JS added by Imre
function getCleanURL(aTag,doc)
{
   URLString = aTag.href.substring(aTag.href.indexOf( "#" ), aTag.href.length);
   realURL = doc.URL;
   if(realURL.indexOf("#") > -1) realURL = realURL.substring(0,realURL.indexOf("#"))
   return realURL+URLString
}

function isLinkNotExternal(aTag, baseTag)
{
   bt = new RegExp(baseTag.href,"i")
   t =  bt.exec(aTag.href)   
   return t;
}

function fixBaseAnchorLinks(doc)
{
   var baseTag = null;
   if(doc.getElementsByTagName("base").length > 0) baseTag = doc.getElementsByTagName("base")[0]   
   if(baseTag == null) return false;   
   all_links = doc.getElementsByTagName("a");
   for(var i=0; i < all_links.length; i++)
   {
      var a = all_links[i];
      
      if(a.href.indexOf("#") > -1 && isLinkNotExternal(a, baseTag)) 
      {
	 a.href = getCleanURL(a,doc);
      }
   }   
}
//end temp JS added by Imre	
function toggleTextBox(a){
	if(document.getElementById(a).style.display  == "block")
		{document.getElementById(a).style.display="none";}
	else
	{document.getElementById(a).style.display="block";}	
}
function ToggleImage(objImage)
{
	var strPics=objImage.attributes["pics"];
	if (!strPics)
	return false;
	var curPic=objImage.attributes["curPic"];
	if (!curPic)
	return false;
	strPics=objImage.attributes["pics"].value;
	curPic=objImage.attributes["curPic"].value;
	curPic=(curPic)*(-1)*(-1);
	var arrPics=strPics.split(",");
	curPic = ((curPic+1) % arrPics.length);
	objImage.src = arrPics[curPic];
	objImage.attributes["curPic"].value = (curPic+"");
}

function popup(url){
	pw = window.open(url,'pw','width=675,height=450,directories=yes,location=no,menubar=yes,scrollbars=yes,status=no,toolbar=no,resizable=yes');
}


function niftyCorners(){
if(!NiftyCheck())
    return;
Rounded("div#VPT","all","#FFFFF7","#FFFFE1","medium border #D6AE4A");
Rounded("div#Insider","all","#FFFFF7","#F8F3B9","medium border #EDE29E");
Rounded("div#ContactShort","all","#FFFFF7","#FFFFD0","medium border #DBD9D9");
Rounded("div#FolioTestimonial","all","#FFFFF7","#FFFFF7","medium border #DBD9D9");	
Rounded("div#VPT","all","#FFFFF7","#FFFFE1","medium border #D6AE4A");
}

function showLinks(DomainRelationship)
{
	if (document.getElementById('Hide_'+DomainRelationship).style.display == "none")
	{
		document.getElementById('Hide_'+DomainRelationship).style.display = 'block';
		document.getElementById(DomainRelationship+'ShowAllLabel').innerHTML = 'Show fewer procedures';
	}
	else if (document.getElementById('Hide_'+DomainRelationship).style.display == "block")
	{
		document.getElementById('Hide_'+DomainRelationship).style.display = 'none';
		document.getElementById(DomainRelationship+'ShowAllLabel').innerHTML = 'Show all procedures they perform';
	}
}

function showLinksCoupons(DomainRelationshipCoupons)
{
	if (document.getElementById('Hide_'+DomainRelationshipCoupons).style.display == "none")
	{
		document.getElementById('Hide_'+DomainRelationshipCoupons).style.display = 'block';
		document.getElementById(DomainRelationshipCoupons+'ShowAllLabel').innerHTML = 'Show fewer coupons';
	}
	else if (document.getElementById('Hide_'+DomainRelationshipCoupons).style.display == "block")
	{
		document.getElementById('Hide_'+DomainRelationshipCoupons).style.display = 'none';
		document.getElementById(DomainRelationshipCoupons+'ShowAllLabel').innerHTML = 'Show more coupons';
	}
}