﻿function PrintFriendly(pageURL) 
{	
	window.open(pageURL, "Print Invoice", "width=980, height=500, toolbar=1, scrollbars=1, left=100, top=50");
}
function SearchBoxOut()
{    
    try
    {        
        document.getElementById('ctl00_txtSearch').className = "fl vm searchbox";
        if(document.getElementById('ctl00_txtSearch').value == "")
        {
           document.getElementById('ctl00_txtSearch').value = "Start Your Search Here";
        }        
    }
    catch(Error){alert(Error);}
    return false;
}
function SearchBoxIn()
{    
    try
    {
        document.getElementById('ctl00_txtSearch').className="fl vm SearchBoxBlack";        
        if(document.getElementById('ctl00_txtSearch').value == "Start Your Search Here")
        {
           document.getElementById('ctl00_txtSearch').value = "";
        }
    }
    catch(Error){alert(Error);}
    return false;
}
function onSubimtCheck()
{
    try
    {
        if((document.getElementById('ctl00_cpContents_ucRegister_txtFName').value) == "")
		{
		    document.getElementById('ctl00_cpContents_ucRegister_txtFName').select();
		    document.getElementById('ctl00_cpContents_ucRegister_txtFName').focus();
		    var lblMsg = document.getElementById('ctl00_cpContents_ucRegister_lblMsg');
		    lblMsg.innerHTML="Please enter your first name.";
		    return false;
		}
		if((document.getElementById('ctl00_cpContents_ucRegister_txtEmail').value) == "")
		{
			document.getElementById('ctl00_cpContents_ucRegister_txtEmail').select();
			document.getElementById('ctl00_cpContents_ucRegister_txtEmail').focus();
		    var lblMsg = document.getElementById('ctl00_cpContents_ucRegister_lblMsg');
		    lblMsg.innerHTML="Please enter your email address.";
			return false;
		}
		else
		{
			if(CheckEmail(document.getElementById('ctl00_cpContents_ucRegister_txtEmail').value) == null)
			{
			    document.getElementById('ctl00_cpContents_ucRegister_txtEmail').select();
			    document.getElementById('ctl00_cpContents_ucRegister_txtEmail').focus();
		        var lblMsg = document.getElementById('ctl00_cpContents_ucRegister_lblMsg');
		        lblMsg.innerHTML='You have provided invalid E-mail address, kindly correct it.';
			    return false;
			}
		}
    }
    catch(err)
    {
        alert(err);
        return false;
    }
}
function CheckEmail(strEmail)
{
    try
    {
        var good;
        strEmail=(strEmail);
        if(strEmail=="")
            return false;
        good=strEmail.match(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/);
        return good;
    }
    catch(err)
	{
	    return false;
	}
}
function ComingSoon()
{
    alert('Coming Soon');
    return false;    
}

function HTTPReferrer()
{
    if (document.referrer != '')
    {
   	    createCookie('HTTPReferrer',document.referrer,1);
   	}
}

function createCookie(name,value,days) 
{
    if (days) 
    {
        var date = new Date();
        date.setTime(date.getTime()+(days*60*60*1000));
        var expires = "; expires="+date.toGMTString();
    }
    else var expires = "";
    document.cookie = name+"="+value+expires+"; path=/";
}

function toggleDiv(divid,me)
{
    if(document.getElementById(divid).style.display == 'block')
    {
        document.getElementById(divid).style.display = 'none';
        document.getElementById(me).src='http://www.healthsuperstore.com/health/images/Common/plus_icon.gif';
    }
    else
    {
        document.getElementById(divid).style.display = 'block';
        document.getElementById(me).src='http://www.healthsuperstore.com/health/images/Common/minimize_icon.gif';
    }
}
