﻿// JScript File

//Funciton for setting the status of all the checkboxes with the name specified by the 
//second parameter on click of the checkbox specified by the first parameter 
function checkAll(obj,itemCheckBoxName)
{
    var arrControls=document.getElementsByTagName("input");
    
        for(var i=0;i<arrControls.length;i++)
        {
            
            
            if(arrControls[i].name.indexOf(itemCheckBoxName)>-1)
            {
                if(obj.checked==true)
                    arrControls[i].checked=true;
                else
                    arrControls[i].checked=false;
            }
        }
}

function checkAll1(obj,itemCheckBoxName,gridName)
{
    var arrControls=document.getElementsByTagName("input");
    
    for(var i=0;i<arrControls.length;i++)
    {
        if(arrControls[i].name.indexOf(itemCheckBoxName)>-1 && arrControls[i].name.indexOf(gridName)>-1)
        {
            if(obj.checked==true)
                arrControls[i].checked=true;
            else
                arrControls[i].checked=false;
        }
    }
}



function unCheck(obj,checkallName)
{
    if(obj.checked==false)
    {
        var arrControls=document.getElementsByTagName("input");
        for(var i=0;i<arrControls.length;i++)
        {
            if(arrControls[i].name.indexOf(checkallName)>-1)
            {
                arrControls[i].checked=false;
                
            }
        }
    }
   
}


function CheckDelete(itemCheckBoxName)
{
    var arrControls=document.getElementsByTagName("input");
    var count=0;
    var recCount=0;
        for(var i=0;i<arrControls.length;i++)
        {
            
            if(arrControls[i].name.indexOf(itemCheckBoxName)>-1)
            {
                recCount=recCount + 1;
                if(arrControls[i].checked==true)
                count=count+1;
            }
        }
        if(recCount==0)
        {
            alert("No records available");
            return false;
        }
        if(count==0 && recCount>0) 
        {
            alert("Please select at least one record to delete.");
            return false;
        }
        else
        {
            if(window.confirm("Are you sure to delete the record(s)?")==false)
                return false;
            else
                return true;   
        }
            
            
    return true;
}



function CheckUplaodfeed(itemCheckBoxName) {
    var arrControls = document.getElementsByTagName("input");
    var count = 0;
    var recCount = 0;
    for (var i = 0; i < arrControls.length; i++) {

        if (arrControls[i].name.indexOf(itemCheckBoxName) > -1) {
            recCount = recCount + 1;
            if (arrControls[i].checked == true)
                count = count + 1;
        }
    }
    if (recCount == 0) {
        alert("No records available");
        return false;
    }
    if (count == 0 && recCount > 0) {
        alert("Please select at least one record to uplaod feed.");
        return false;
    }
    return true;
}
///Author :         Shatabdi Dey
/// Added on Date : 13 May 2008

function CheckCategoryProductLink(itemCheckBoxName)
{
    var arrControls=document.getElementsByTagName("input");
    var count=0;
        for(var i=0;i<arrControls.length;i++)
        {
            
            if(arrControls[i].name.indexOf(itemCheckBoxName)>-1)
            {
                if(arrControls[i].checked==true)
                count=count+1;
            }
        }
        
        if(count==0)
        {
            alert("Please select at least one Category for the Product");
            return false;
        }
        else
        {            
                return true;   
        }
            
            
    return true;
}


function approveRecords(itemCheckBoxName)
{
    var arrControls=document.getElementsByTagName("input");
    var count=0;
    var recCount=0;
    
    for(var i=0;i<arrControls.length;i++)
    {
        
        if(arrControls[i].name.indexOf(itemCheckBoxName)>-1)
        {
            recCount=recCount+ 1;
            if(arrControls[i].checked==true)
            count=count+1;
        }
    }
    
    if(recCount==0)
    {
        alert("No records available.");
        return false;
    }
    if(count==0 && recCount>0)
    {
        alert("Please select at least one record.");
        return false;
    }
    else
    {
        if(window.confirm("Are you sure to approve these records?")==false)
            return false;
        else
            return true;   
    }
            
            
    return true;
}

function rejectRecords(itemCheckBoxName)
{
    var arrControls=document.getElementsByTagName("input");
    var count=0;
    var recCount=0;
        for(var i=0;i<arrControls.length;i++)
        {
            
            if(arrControls[i].name.indexOf(itemCheckBoxName)>-1)
            {
                recCount=recCount+ 1;
                if(arrControls[i].checked==true)
                count=count+1;
            }
        }
        
        if(recCount==0)
        {
            alert("No records available.");
            return false;
        }
        if(count==0 && recCount>0)
        {
            alert("Please select at least one record.");
            return false;
        }
        else
        {
            if(window.confirm("Are you sure to reject these record(s)?")==false)
                return false;
            else
                return true;   
        }
            
            
    return true;
}


function activateRecords(itemCheckBoxName)
{
    var arrControls=document.getElementsByTagName("input");
    var count=0;
    var recCount=0;
    
    for(var i=0;i<arrControls.length;i++)
    {
        
        if(arrControls[i].name.indexOf(itemCheckBoxName)>-1)
        {
            recCount=recCount+ 1;
            if(arrControls[i].checked==true)
            count=count+1;
        }
    }
    
    if(recCount==0)
    {
        alert("No records available.");
        return false;
    }
    if(count==0 && recCount>0)
    {
        alert("Please select at least one record.");
        return false;
    }
    else
    {
        if(window.confirm("Are you sure to activate these records?")==false)
            return false;
        else
            return true;   
    }
            
            
    return true;
}

function deactivateRecords(itemCheckBoxName)
{
    var arrControls=document.getElementsByTagName("input");
    var count=0;
    var recCount=0;
    
    for(var i=0;i<arrControls.length;i++)
    {
        
        if(arrControls[i].name.indexOf(itemCheckBoxName)>-1)
        {
            recCount=recCount+ 1;
            if(arrControls[i].checked==true)
            count=count+1;
        }
    }
    
    if(recCount==0)
    {
        alert("No records available.");
        return false;
    }
    if(count==0 && recCount>0)
    {
        alert("Please select at least one record.");
        return false;
    }
    else
    {
        if(window.confirm("Are you sure to inactivate these records?")==false)
            return false;
        else
            return true;   
    }
            
            
    return true;
}

function setInStock(itemCheckBoxName)
{
    var arrControls=document.getElementsByTagName("input");
    var count=0;
    var recCount=0;
    
    for(var i=0;i<arrControls.length;i++)
    {
        
        if(arrControls[i].name.indexOf(itemCheckBoxName)>-1)
        {
            recCount=recCount+ 1;
            if(arrControls[i].checked==true)
            count=count+1;
        }
    }    
    if(recCount==0)
    {
        alert("No records available.");
        return false;
    }
    if(count==0 && recCount>0)
    {
        alert("Please select at least one record.");
        return false;
    }
    else
    {
        if(window.confirm("Are you sure to set the status of selected products to In Stock?")==false)
            return false;
        else
            return true;   
    }
            
            
    return true;
}

function setOutOfStock(itemCheckBoxName)
{
    var arrControls=document.getElementsByTagName("input");
    var count=0;
    var recCount=0;
    
    for(var i=0;i<arrControls.length;i++)
    {
        
        if(arrControls[i].name.indexOf(itemCheckBoxName)>-1)
        {
            recCount=recCount+ 1;
            if(arrControls[i].checked==true)
            count=count+1;
        }
    }
    
    if(recCount==0)
    {
        alert("No records available.");
        return false;
    }
    if(count==0 && recCount>0)
    {
        alert("Please select at least one record.");
        return false;
    }
    else
    {
        if(window.confirm("Are you sure to set the status of selected products to Out Of Stock?")==false)
            return false;
        else
            return true;   
    }
            
            
    return true;
}




function CheckStatusModified(itemCheckBoxName,msg,confirmMsg)
{
    
    var arrControls=document.getElementsByTagName("input");
    var count=0;
        for(var i=0;i<arrControls.length;i++)
        {
            
            if(arrControls[i].name.indexOf(itemCheckBoxName)>-1)
            {
                if(arrControls[i].checked==true)
                count=count+1;
            }
        }
        
        if(count==0)
        {
            alert(msg);
            return false;
        }
        else
        {
            if(window.confirm(confirmMsg)==false)
                return false;
            else
                return true;   
        }
            
            
    return true;
}


function ChangePrice(obj) {
    //if(obj.selectedIndex!=0)
    //{
        var objlblProPrice=document.getElementById("ctl00_contentWorkingArea_lblProPriceInCurrency");
        var objlblListPrice=document.getElementById("ctl00_contentWorkingArea_lblListPriceInCurrency");
        var originalProPrice=document.getElementById("ctl00_contentWorkingArea_hdnProPrice").value;
        var originalListPrice = document.getElementById("ctl00_contentWorkingArea_hdnListProPrice").value;
        var originalushandle = document.getElementById("ctl00_contentWorkingArea_lblushandle");

        
        var currencyParts=obj.options[obj.selectedIndex].value.split('~');
        var newProPrice= "(~" + currencyParts[0] +  "&nbsp;" + Math.round((originalProPrice * currencyParts[1]) * 100)/100 + ")";
        var newListPrice = "(~" + currencyParts[0] + "&nbsp;" + Math.round((originalListPrice * currencyParts[1]) * 100) / 100 + ")";

        if (objlblProPrice != null) 
        {
        	objlblProPrice.innerHTML = newProPrice;
        }
        if (objlblListPrice != null) 
        {
        	objlblListPrice.innerHTML = newListPrice;
        }
        

        
        //originalushandle.innerHTML = "Please note, this transactions is handled in U.S. Dollars. Prices in other currencies are shown for reference only.";
        originalushandle.innerHTML = "Please note, this transactions is handled in <b>" + document.getElementById("ctl00_contentWorkingArea_htxtcurr").value + "</b>. Prices in other currencies are shown for reference only.";


        var objlblWPrice = document.getElementById("ctl00_contentWorkingArea_lblwholepriceInCurrency");
        var originalwprice = document.getElementById("ctl00_contentWorkingArea_hwprice").value;
        var newWPrice = "(~" + currencyParts[0] + "&nbsp;" + Math.round((originalwprice * currencyParts[1]) * 100) / 100 + ")";
        if (objlblWPrice != null) 
        {
            objlblWPrice.innerHTML = newWPrice;    
        }
                
//      var objLabel=document.getElementById("ctl00_contentWorkingArea_lblProPrice");
//      var originalPrice=document.getElementById("ctl00_contentWorkingArea_hdnProPrice").value;
//      var currencyParts=obj.options[obj.selectedIndex].value.split('~');
//      var newPrice= "<b>" + currencyParts[0] + "</b>" + "&nbsp;" + Math.round((originalPrice * currencyParts[1]) * 100)/100;
        //      objLabel.innerHTML=newPrice;

        ajaxFunction(obj.options[obj.selectedIndex].value);
    //}
}



function ajaxFunction(cid) {
    
    var xmlHttp;
    try {
        // Firefox, Opera 8.0+, Safari
        xmlHttp = new XMLHttpRequest();
    }
    catch (e) {
        // Internet Explorer
        try {
            xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
        }
        catch (e) {
            try {
                xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
            }
            catch (e) {
                alert("Your browser does not support AJAX!");
                return false;
            }
        }
    }
    xmlHttp.onreadystatechange = function() {
        if (xmlHttp.readyState == 4) {
            //alert(xmlHttp.responseText);
            //document.getElementById("ctl00_ContentPlaceHolder1_div2").innerHTML = xmlHttp.responseText;
        }
    }
    xmlHttp.open("GET", "currencyid.aspx?cid=" + cid, true);
    xmlHttp.send(null);
}



function ChangePage(pageToShow,pageToHide,mode)
{
    
    document.getElementById("ctl00_contentWorkingArea_" + pageToShow).style.display="";
    document.getElementById("ctl00_contentWorkingArea_" + pageToHide).style.display="none";   
    if(mode=="Next")
    {
        document.getElementById("ctl00_txtSearch").focus();
        document.getElementById("ctl00_contentWorkingArea_ddlCardType").focus();
    }
    else
    {
        document.getElementById("ctl00_txtSearch").focus();
        document.getElementById("ctl00_contentWorkingArea_txtBillingAddress").focus();        
    }
    return false; 
}


function showHideCreditCardDetails(obj,divId)
{
    if(obj.id.indexOf('optCC')>-1)
        document.getElementById(divId).style.display='';
    else if(obj.id.indexOf('optMO')>-1 || obj.id.indexOf('OptC')>-1)
    {
        document.getElementById(divId).style.display='none';
    }
}

function showHidePayOptions(obj,divPayById,divCreditCardDetails,divOtherInfo)
{
    if(obj.id.indexOf('optPay')>-1)
    {
        document.getElementById(divId).style.display='';
        document.getElementById(divCreditCardDetails).style.display='';
        document.getElementById(divOtherInfo).style.display='';
    }
    else if(obj.id.indexOf('optVoucher')>-1) 
    {
        document.getElementById(divId).style.display='none';
        document.getElementById(divCreditCardDetails).style.display='none';
        document.getElementById(divOtherInfo).style.display='none';
        
    }
}

function copyBillingAddressToShippingAddress(oChk)
{
    if (oChk.checked)
    {
        document.getElementById('ctl00_contentWorkingArea_txtShipAddress').value=document.getElementById('ctl00_contentWorkingArea_txtBillAddress').value
        document.getElementById('ctl00_contentWorkingArea_ddlShipCountry').selectedIndex=document.getElementById('ctl00_contentWorkingArea_ddlBillCountry').selectedIndex
        document.getElementById('ctl00_contentWorkingArea_txtShipState').value=document.getElementById('ctl00_contentWorkingArea_txtBillState').value
        document.getElementById('ctl00_contentWorkingArea_txtShipCity').value=document.getElementById('ctl00_contentWorkingArea_txtBillCity').value
        document.getElementById('ctl00_contentWorkingArea_txtShipZipCode').value=document.getElementById('ctl00_contentWorkingArea_txtBillZipCode').value
        document.getElementById('ctl00_contentWorkingArea_txtShipPhone').value=document.getElementById('ctl00_contentWorkingArea_txtBillPhone').value
        document.getElementById('ctl00_contentWorkingArea_txtShipFax').value=document.getElementById('ctl00_contentWorkingArea_txtBillFax').value
    }
    else
    {
        document.getElementById('ctl00_contentWorkingArea_txtShipAddress').value="";
        document.getElementById('ctl00_contentWorkingArea_ddlShipCountry').selectedIndex=0;
        document.getElementById('ctl00_contentWorkingArea_txtShipState').value="";
        document.getElementById('ctl00_contentWorkingArea_txtShipCity').value="";
        document.getElementById('ctl00_contentWorkingArea_txtShipZipCode').value="";
        document.getElementById('ctl00_contentWorkingArea_txtShipPhone').value="";
        document.getElementById('ctl00_contentWorkingArea_txtShipFax').value="";
    }
}


function OnPwdYESNO(txtCntrl,rdoCntrl)
{
    var _obj = document.getElementById(txtCntrl)
    if (_obj)
    {
        _obj = document.getElementById(rdoCntrl)
        _obj.checked=true;
    }
    return true;
}


function showConfirmOnCheckOut()
{
    var result=window.confirm("Are you sure to check out!");
    if(result==true)
        return true;
    else
        return false;
}

function showConfirmOnDelete()
{
    var result=window.confirm("Are you sure to delete!");
    if(result==true)
        return true;
    else
        return false;
}


function CreateBookmarkLink() 
{
	//alert(location.href);
	if (document.all) window.external.AddFavorite(location.href, location.href);
	else if (window.sidebar) window.sidebar.addPanel(location.href, location.href, '');
}


function checkKey(b1, e) 
{
	if (e.keyCode == 13) 
	{
		document.getElementById(b1).click();
		return false;
	}
}


function checkText(txtid) {
        if (document.getElementById(txtid).value == "") {
            alert("Please enter search text");
            return false;
        }
    }
 
    function openGooglePopup(obj) {
        var txtSearchVal
        if (obj.id == 'ctl00_Sitesearch_Header_btnWebSearch')
            txtSearchVal = document.getElementById('ctl00_Sitesearch_Header_txtSearch')
        else
            txtSearchVal = document.getElementById('ctl00_Sitesearch_Footer_txtSearch')
        if (txtSearchVal.value != '')
            window.location.href = 'searchresults.aspx?st=' + txtSearchVal.value;
    }


	
	function FunKampyle()
	{
		var k_push_vars = {
            "display_after": 30,
            "view_percentage": 50,
            "popup_font_color": "#000000",
            "popup_background": "#ffffff",
            "popup_separator": "#D4E2F0",
            "header": "Your feedback is important to us!",
            "question": "Would you be willing to give us a short (1 minute) feedback?",
            "footer": "Thank you for helping us improve our website",
            "remind": "Remind me later",
            "remind_font_color": "#3882C3",
            "yes": "Yes",
            "no": "No",
            "text_direction": "ltr",
            "images_dir": "http://cf.kampyle.com/",
            "yes_background": "#76AC78",
            "no_background": "#8D9B86",
            "site_code": 8361405
        }
	}
	
	
	function checkQuantity()
	{
		if (document.getElementById("ctl00_contentWorkingArea_txtQuantity").value == "")
		{
			alert("Please enter Quantity.")
			return false;
		}
		if (!isInt(document.getElementById("ctl00_contentWorkingArea_txtQuantity").value))
		{
			alert("Please enter Numeric value for Quantity.")
			return false;
		}
		if (parseInt(document.getElementById("ctl00_contentWorkingArea_txtQuantity").value) <= 0)
		{
			alert("Quantity must be non empty and greater than 0.")
			return false;
		}
	}
	
	
	function checkOOSemail()
	{
		if (document.getElementById("ctl00_contentWorkingArea_oosemail").value == "")
		{
			alert("Please enter Email Id.")
			return false;
		}
		if (!check_email(document.getElementById("ctl00_contentWorkingArea_oosemail").value))
		{
			alert("Please enter valid Email Id.")
			return false;
		}
		
	}
	
	
	function checkFriendemail()
	{
		if (document.getElementById("ctl00_contentWorkingArea_txtEmailId").value == "")
		{
			alert("Please enter Email Id.")
			return false;
		}
		if (!check_email(document.getElementById("ctl00_contentWorkingArea_txtEmailId").value))
		{
			alert("Please enter valid Email Id.")
			return false;
		}
		
	}
	
	function callOnChkout() 
	{
		alert("Cart is empty.\n\nPlease select some products.");
		return false;
	}

	function cleartext() 
	{
		document.getElementById("ctl00_contentWorkingArea_txtdiscode").value = "";
	}
	
	
	
	function checkdiscode()
	{
		if (document.getElementById("ctl00_contentWorkingArea_txtdiscode").value == "")
		{
			alert("Please enter Discount Code")
			return false;
		}
	}
	
	
	function fnCheckSel1(intObjId)
		{
			var strSceTypeId; 
			strSceTypeId = intObjId + "1";
			for (var i = 1; i < document.aspnetForm.length; i++) {
			    if (document.aspnetForm.elements[i].id) {
			        if (document.aspnetForm.elements[i].id.indexOf("rb") != -1) {
			            if (document.aspnetForm.elements[i].id.indexOf("rb1") == -1) {
			                document.aspnetForm.elements[i].checked = false;
				}}}} 
			document.getElementById(intObjId).checked=true;

        }
		
	function valid_email() {
            if (document.getElementById("ctl00_contentWorkingArea_txtEmailId").value == "") {
                alert("Please enter email address");
                document.getElementById("ctl00_contentWorkingArea_txtEmailId").focus();
                return false;
            }
            if (document.getElementById("ctl00_contentWorkingArea_rdoYES").checked == true) {
                if (document.getElementById("ctl00_contentWorkingArea_txtPassword").value == "") {
                    alert("Please enter password");
                    document.getElementById("ctl00_contentWorkingArea_txtPassword").focus();
                    return false;
                }
            }
        }	
		
		
	function focusOnEmailAddress() {
            var txtEmailId_Client = document.getElementById('ctl00_contentWorkingArea_txtEmailId');
            //alert(txtEmailId_Client.name);
            txtEmailId_Client.focus();
        }
        function focusOnPassword() {
            var txtPassword_Client = document.getElementById('ctl00_contentWorkingArea_txtPassword');
            //alert(txtPassword_Client.name);
            txtPassword_Client.focus();
        }



        function checkback(flag) { 
        try
        {

        	if (document.getElementById("ctl00_contentWorkingArea_rbtvisa").checked == true) {
        		document.getElementById("ctl00_contentWorkingArea_Creditcardlist").style.display = "block";
        		document.getElementById("ctl00_contentWorkingArea_ltrpaybuy").innerHTML = "<img alt='' src='images/visa-sm.gif'> Total Amount " + document.getElementById("ctl00_contentWorkingArea_ltrvisa").innerHTML + "";
        	}
        	else if (document.getElementById("ctl00_contentWorkingArea_rbtmaster").checked == true) {
        		document.getElementById("ctl00_contentWorkingArea_Creditcardlist").style.display = "block";
        		document.getElementById("ctl00_contentWorkingArea_ltrpaybuy").innerHTML = "<img alt='' src='images/master-sm.gif'> Total Amount " + document.getElementById("ctl00_contentWorkingArea_ltrmaster").innerHTML + "";
        	}
        	else if (document.getElementById("ctl00_contentWorkingArea_rbtammerican").checked == true) {
        		document.getElementById("ctl00_contentWorkingArea_Creditcardlist").style.display = "block";
        		document.getElementById("ctl00_contentWorkingArea_ltrpaybuy").innerHTML = "<img alt='' src='images/american-sm.gif'> Total Amount " + document.getElementById("ctl00_contentWorkingArea_ltrammerican").innerHTML + "";
        	}
        	else if (document.getElementById("ctl00_contentWorkingArea_rbtjcb").checked == true) {
        		document.getElementById("ctl00_contentWorkingArea_Creditcardlist").style.display = "block";
        		document.getElementById("ctl00_contentWorkingArea_ltrpaybuy").innerHTML = "<img alt='' src='images/jcb-sm.gif'> Total Amount " + document.getElementById("ctl00_contentWorkingArea_ltrjcb").innerHTML + "";
        	}
        	else if (document.getElementById("ctl00_contentWorkingArea_rbtdinner").checked == true) {
        		document.getElementById("ctl00_contentWorkingArea_Creditcardlist").style.display = "block";
        		document.getElementById("ctl00_contentWorkingArea_ltrpaybuy").innerHTML = "<img alt='' src='images/diner-sm.gif'> Total Amount " + document.getElementById("ctl00_contentWorkingArea_ltrdinner").innerHTML + "";
        	}
        	else if (document.getElementById("ctl00_contentWorkingArea_rbtPaypal").checked == true) {
        	    document.getElementById("ctl00_contentWorkingArea_Creditcardlist").style.display = "none";
        	    document.getElementById("ctl00_contentWorkingArea_ltrpaybuy").innerHTML = "<img alt='' src='images/paypal-sm.gif'> Total Amount " + document.getElementById("ctl00_contentWorkingArea_ltrpaypal").innerHTML + "";
        	}
        	else if (document.getElementById("ctl00_contentWorkingArea_rbtBank").checked == true) {
        	    document.getElementById("ctl00_contentWorkingArea_Creditcardlist").style.display = "none";
        	    document.getElementById("ctl00_contentWorkingArea_ltrpaybuy").innerHTML = "Bank Deposit Total Amount " + document.getElementById("ctl00_contentWorkingArea_ltrvisa").innerHTML + "";
        	}
        }
        catch (err) {
            //document.getElementById("ctl00_contentWorkingArea_paypal").style.backgroundColor = "#DDF1FD";
        }
    }
	
	
	function ccpopup() 
        {	
            if (document.getElementById("ctl00_contentWorkingArea_rbtvisa").checked == true || document.getElementById("ctl00_contentWorkingArea_rbtmaster").checked == true || document.getElementById("ctl00_contentWorkingArea_rbtammerican").checked == true || document.getElementById("ctl00_contentWorkingArea_rbtjcb").checked == true || document.getElementById("ctl00_contentWorkingArea_rbtdinner").checked == true) 
			{
				if (document.getElementById("ctl00_contentWorkingArea_rbtvisa").checked == false && document.getElementById("ctl00_contentWorkingArea_rbtmaster").checked == false && document.getElementById("ctl00_contentWorkingArea_rbtammerican").checked == false && document.getElementById("ctl00_contentWorkingArea_rbtjcb").checked == false && document.getElementById("ctl00_contentWorkingArea_rbtdinner").checked == false) 
		        {
		            document.getElementById("ctl00_contentWorkingArea_lblError").innerHTML = "Please select card type";
		            return false;
		        }
		        if (document.getElementById("ctl00_contentWorkingArea_txtcardno") == "" || document.getElementById("ctl00_contentWorkingArea_txtcardno").value.length < 16)
		        {
		            if (document.getElementById("ctl00_contentWorkingArea_rbtammerican").checked == true )
		            {
		                if (document.getElementById("ctl00_contentWorkingArea_txtcardno").value == "" || document.getElementById("ctl00_contentWorkingArea_txtcardno").value.length < 15)
		                {
		                    document.getElementById("ctl00_contentWorkingArea_lblError").innerHTML = "Please enter valid card no.";
		                    return false;
		                }
						else { 
							if ( ! /^(\d+)$/.test(document.getElementById("ctl00_contentWorkingArea_txtcardno").value) ) { 
								document.getElementById("ctl00_contentWorkingArea_lblError").innerHTML = "Please enter credit card number in numeric value.";
								return false;
							}
						}
		            }
		            else if (document.getElementById("ctl00_contentWorkingArea_rbtdinner").checked == true)
		            {
		                if (document.getElementById("ctl00_contentWorkingArea_txtcardno").value == "" || document.getElementById("ctl00_contentWorkingArea_txtcardno").value.length != 14)
		                {
		                    document.getElementById("ctl00_contentWorkingArea_lblError").innerHTML = "Please enter valid card no.";
		                    return false;
		                }
						else {
							if ( ! /^(\d+)$/.test(document.getElementById("ctl00_contentWorkingArea_txtcardno").value) ) { 
								document.getElementById("ctl00_contentWorkingArea_lblError").innerHTML = "Please enter credit card number in numeric value.";
								return false;
							}
						}
		            }
		            else
		            {
		                document.getElementById("ctl00_contentWorkingArea_lblError").innerHTML = "Please enter valid card no.";
		                return false;
		            }
		            
		        }
				else { 
					if ( ! /^(\d+)$/.test(document.getElementById("ctl00_contentWorkingArea_txtcardno").value) ) { 
						document.getElementById("ctl00_contentWorkingArea_lblError").innerHTML = "Please enter credit card number in numeric value.";
						return false;
					}
				}
				
		        if (document.getElementById("ctl00_contentWorkingArea_txtCardholder").value == "")
		        {
		            document.getElementById("ctl00_contentWorkingArea_lblError").innerHTML = "Please enter Cardholder's Name";
		            return false;
		        }
		        if (document.getElementById("ctl00_contentWorkingArea_ddlExpiryMonth").value == 0)
		        {
		            document.getElementById("ctl00_contentWorkingArea_lblError").innerHTML = "Please select expiration month";
		            return false;
		        }
		        if (document.getElementById("ctl00_contentWorkingArea_ddlExpiryYear").value == 0)
		        {
		            document.getElementById("ctl00_contentWorkingArea_lblError").innerHTML = "Please select expiration year";
		            return false;
		        }

		        if (document.getElementById("ctl00_contentWorkingArea_txtcvv").value == "" || document.getElementById("ctl00_contentWorkingArea_txtcvv").value.length < 3)
		        {
		            document.getElementById("ctl00_contentWorkingArea_lblError").innerHTML = "Please enter valid cvv";
		            return false;
		        }
		        else
		        {
		            if (document.getElementById("ctl00_contentWorkingArea_rbtammerican").checked == false && document.getElementById("ctl00_contentWorkingArea_txtcvv").value.length != 3)
		            {
		                document.getElementById("ctl00_contentWorkingArea_lblError").innerHTML = "Please enter valid cvv";
		                return false;
		            }
		            else if (document.getElementById("ctl00_contentWorkingArea_rbtammerican").checked == true && document.getElementById("ctl00_contentWorkingArea_txtcvv").value.length != 4)
		            {
		                document.getElementById("ctl00_contentWorkingArea_lblError").innerHTML = "Please enter valid cvv";
		                return false;
		            }
		        }
			}
			//if (document.getElementById("ctl00_contentWorkingArea_rbtCard").checked == true) 
            if (document.getElementById("ctl00_contentWorkingArea_rbtvisa").checked == true || document.getElementById("ctl00_contentWorkingArea_rbtmaster").checked == true || document.getElementById("ctl00_contentWorkingArea_rbtammerican").checked == true || document.getElementById("ctl00_contentWorkingArea_rbtjcb").checked == true || document.getElementById("ctl00_contentWorkingArea_rbtdinner").checked == true) 
			{
                var windowHeight = window.innerHeight ? window.innerHeight : document.documentElement.clientHeight ? document.documentElement.clientHeight : document.body.clientHeight;
                var windowWidth = window.innerWidth ? window.innerWidth : document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body.clientWidth;
                
				var scrOfX = 0, scrOfY = 0;
				  if( typeof( window.pageYOffset ) == 'number' ) {
				    //Netscape compliant
				    scrOfY = window.pageYOffset;
				    scrOfX = window.pageXOffset;
				  } else if( document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
				    //DOM compliant
				    scrOfY = document.body.scrollTop;
				    scrOfX = document.body.scrollLeft;
				  } else if( document.documentElement && ( document.documentElement.scrollLeft || document.documentElement.scrollTop ) ) {
				    //IE6 standards compliant mode
				    scrOfY = document.documentElement.scrollTop;
				    scrOfX = document.documentElement.scrollLeft;
				  }

				
                var IpopTop = ((windowHeight - document.getElementById("contentmsg").offsetHeight) / 2);
                var IpopLeft = ((windowWidth - document.getElementById("contentmsg").offsetWidth) / 2);
				IpopTop = IpopTop  + scrOfY;
				IpopLeft = IpopLeft + scrOfX;
				
				document.getElementById("contentmsg").style.top = IpopTop + 'px' ;
                document.getElementById("contentmsg").style.left = IpopLeft + 'px';
				
				document.getElementById("contentmsg").style.visibility = "visible";
				
            }
        } 
		
		
		
	function isNumberKey(evt) 
	{
	    var charCode = (evt.which) ? evt.which : event.keyCode
	    if (charCode > 31 && (charCode < 48 || charCode > 57))
	            return false;

	    return true;
	}
    
    function chackprice() 
	{
        if (document.getElementById("ctl00_contentWorkingArea_txtMinPrice").value == "") {
            alert("Please enter value of minmum price.");
            return false;
        }
        if (document.getElementById("ctl00_contentWorkingArea_txtMaxPrice").value == "") {
            alert("Please enter value of maximum price.");
            return false;
        }
        if (parseInt(document.getElementById("ctl00_contentWorkingArea_txtMaxPrice").value) <= parseInt(document.getElementById("ctl00_contentWorkingArea_txtMinPrice").value)) {
            alert("Maximum price should be greater then minimum price.");
            return false;
        }
    }
		
	function chkfields() 
        {
            if (document.getElementById("ctl00_contentWorkingArea_txtPassword").value == "") {
                alert("Please enter old password");
                document.getElementById("ctl00_contentWorkingArea_txtPassword").focus();
                return false;
            }
            if (document.getElementById("ctl00_contentWorkingArea_txtNewPassword").value == "") {
                alert("Please enter new password");
                document.getElementById("ctl00_contentWorkingArea_txtNewPassword").focus();
                return false;
            }
            if (document.getElementById("ctl00_contentWorkingArea_txtRePassword").value == "") {
                alert("Please enter retype address");
                document.getElementById("ctl00_contentWorkingArea_txtRePassword").focus();
                return false;
            }
            if (document.getElementById("ctl00_contentWorkingArea_txtNewPassword").value != document.getElementById("ctl00_contentWorkingArea_txtRePassword").value) 
            {
                alert("New password and Retpe password must be same");
                document.getElementById("ctl00_contentWorkingArea_txtNewPassword").focus();
                return false;
            }
        }

	function cleartext1() {
        document.getElementById("ctl00_contentWorkingArea_txtphone").value = "";
    }
    
    function valid_email1() {
        if (document.getElementById("ctl00_contentWorkingArea_txtemailid").value == "") {
            alert("Please enter email address");
            document.getElementById("ctl00_contentWorkingArea_txtemailid").focus();
            return false;
        }
        if (document.getElementById("ctl00_contentWorkingArea_txtname").value == "") {
            alert("Please enter Full Name");
            document.getElementById("ctl00_contentWorkingArea_txtname").focus();
            return false;
        }
        if (document.getElementById("ctl00_contentWorkingArea_txtsubject").value == "") {
            alert("Please enter Subject");
            document.getElementById("ctl00_contentWorkingArea_txtsubject").focus();
            return false;
        }
        if (document.getElementById("ctl00_contentWorkingArea_txtmessage").value == "") {
            alert("Please enter Message");
            document.getElementById("ctl00_contentWorkingArea_txtmessage").focus();
            return false;
        }
    }


function viewpreview(amount, email) {
        var email = document.getElementById("ctl00_contentWorkingArea_txtRemail").value;
        var toname = document.getElementById("ctl00_contentWorkingArea_txtTo").value;
        var fromname = document.getElementById("ctl00_contentWorkingArea_txtFrom").value;
        var amount = document.getElementById("ctl00_contentWorkingArea_ddlamount").value;
        var message = document.getElementById("ctl00_contentWorkingArea_txtMessage").value;
        //alert(document.getElementById("ctl00_contentWorkingArea_ddlGifttype").value);
        if (document.getElementById("ctl00_contentWorkingArea_ddlGifttype").value == "0") 
        {
            if (email == "") 
            {
                alert('Please enter valid recipient e-mail');
                return false;
            }
            if (!check_email(email)) 
            {
                alert('Please enter valid recipient e-mail');
                document.getElementById("ctl00_contentWorkingArea_txtRemail").focus();
                return false;
            }
        }
        
        
        //var tval = (screen.height - 300) / 2;
        //var lval = (screen.width - 300) / 2;
        var tval = 150;
        var lval = 150;
        var win = window.open('giftpreview.aspx?&amount=' + amount + '&email=' + email + '&toname=' + toname + '&fromname=' + fromname + '&message=' + message, null, 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes,width=300,height=300,top=' + tval + ',left=' + lval, 'true');
        win.focus();
        return false;
    }

    function viewgo(amount, email) {
        var email = document.getElementById("ctl00_contentWorkingArea_txtRemail").value;
        var toname = document.getElementById("ctl00_contentWorkingArea_txtTo").value;
        var fromname = document.getElementById("ctl00_contentWorkingArea_txtFrom").value;
        var amount = document.getElementById("ctl00_contentWorkingArea_ddlamount").value;
        var message = document.getElementById("ctl00_contentWorkingArea_txtMessage").value;
        //alert(document.getElementById("ctl00_contentWorkingArea_ddlGifttype").value);
        if (document.getElementById("ctl00_contentWorkingArea_ddlGifttype").value == "0") {
            if (email == "") {
                alert('Please enter valid recipient e-mail');
                return false;
            }
            if (!check_email(email)) {
                alert('Please enter valid recipient e-mail');
                document.getElementById("ctl00_contentWorkingArea_txtRemail").focus();
                return false;
            }
        }

    }

    function chktype() 
    {
        //alert(document.getElementById("ctl00_contentWorkingArea_ddlGifttype").value);
        if (document.getElementById("ctl00_contentWorkingArea_ddlGifttype").value == "1") 
        {
            //alert(document.getElementById("ctl00_contentWorkingArea_txtRemail").disabled);
            document.getElementById("ctl00_contentWorkingArea_txtRemail").disabled = true;
        }
        else 
        {
            document.getElementById("ctl00_contentWorkingArea_txtRemail").disabled = false;
        }
    }

	function chack() {
        if (document.getElementById("ctl00_contentWorkingArea_txtMinPrice").value == "") {
            alert("Please enter value of minmum price.");
            return false;
        }
        if (document.getElementById("ctl00_contentWorkingArea_txtMaxPrice").value == "") {
            alert("Please enter value of maximum price.");
            return false;
        }
        if (parseInt(document.getElementById("ctl00_contentWorkingArea_txtMaxPrice").value) <= parseInt(document.getElementById("ctl00_contentWorkingArea_txtMinPrice").value)) {
            alert("Maximum price should be greater then minimum price.");
            return false;
        }
    }

function validateCategory2(oSrc,args)
    {
        return;
        //alert(document.getElementById("<%=txtEmailId.ClientID%>").value);
        var txtEml = document.getElementById("<%=txtEmailId.ClientID%>").value;

        if(txtEml.length <= 0)
	    {
	      return false;
	    }
        var splitted = txtEml.match("^(.+)@(.+)$");
        if(splitted == null) {args.IsValid = false; return ;}
        if(splitted[1] != null )
        {
          var regexp_user=/^\"?[\w-_\.]*\"?$/;
          if(splitted[1].match(regexp_user) == null) {args.IsValid = false; return ;}
        }
        if(splitted[2] != null)
        {
          var regexp_domain=/^[\w-\.]*\.[A-Za-z]{2,4}$/;
          if(splitted[2].match(regexp_domain) == null) 
          {
	        var regexp_ip =/^\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\]$/;
	        if(splitted[2].match(regexp_ip) == null) { args.IsValid = false; return ;}
          }// if
          args.IsValid = true;
           return ;
        }
        args.IsValid = false;
        return ;
    }

	function checkorderno() {
            if (emptyField(document.getElementById("ctl00_contentWorkingArea_txtorderid"))) {
                alert('Please Enter Order No.');
                document.getElementById("ctl00_contentWorkingArea_txtorderid").focus();
                return false;
            }
        }

function check_qty(count) 
        {
            
                var con="";
                if(count<10)
                {
                    con="0" + count;
                }
                else
                {
                    con=count;
                }

                
                if (emptyField(document.getElementById("ctl00_contentWorkingArea_grdrecords_ctl" + con + "_txtqty"))) {
                    alert('Please enter Quantity');
                    document.getElementById("ctl00_contentWorkingArea_grdrecords_ctl" + con + "_txtqty").focus();
                    return false;
                }

                if (document.getElementById("ctl00_contentWorkingArea_grdrecords_ctl" + con + "_txtqty").value < 1) {
                    alert('Quantity must be Greater then Zero.');
                    document.getElementById("ctl00_contentWorkingArea_grdrecords_ctl" + con + "_txtqty").focus();
                    return false;
                }

                if (!isInt(document.getElementById("ctl00_contentWorkingArea_grdrecords_ctl" + con + "_txtqty").value)) {
                    alert('Please enter Integer value.');
                    document.getElementById("ctl00_contentWorkingArea_grdrecords_ctl" + con + "_txtqty").focus();
                    return false;
                }


                
            
        }

		function cleartext2() {
            document.getElementById("ctl00_contentWorkingArea_txtcustomer").value = "";
        }		
		
		function checkIsShippedStatus(itemCheckBoxName)
        {
            var arrControls=document.getElementsByTagName("input");
            var count=0;
            for(var i=0;i<arrControls.length;i++)
            {

                if(arrControls[i].name.indexOf(itemCheckBoxName)>-1)
                {
                    if(arrControls[i].checked==true)
                    count=count+1;
                }
            }

            if(count==0)
            {
                alert("Please select at least one country");
                return false;
            }
        }
		
		function funloadimage() {
            //alert(imgsrc);
            //alert(document.getElementById("img").src);
            document.getElementById("img").src = document.getElementById("hurl").value;
            //alert(document.getElementById("img").src);
        }

        function copy_to_clipboard() 
        {

            //alert(document.getElementById("ctl00_contentWorkingArea_txtadd").value);
            var text = document.getElementById("ctl00_contentWorkingArea_txtadd").value;
            
            if (window.clipboardData) {
                window.clipboardData.setData('text', text);
            }
            else {
                var clipboarddiv = document.getElementById('divclipboardswf');
                if (clipboarddiv == null) {
                    clipboarddiv = document.createElement('div');
                    clipboarddiv.setAttribute("name", "divclipboardswf");
                    clipboarddiv.setAttribute("id", "divclipboardswf");
                    document.body.appendChild(clipboarddiv);
                }
                clipboarddiv.innerHTML = '<embed src="clipboard.swf" FlashVars="clipboard=' +
                encodeURIComponent(text) + '" width="0" height="0" type="application/x-shockwave-flash"></embed>';
            }
            alert('Shipping Address is copied');
            return false;
        }
		
		
		function winopnepreview() 
		{
			window.open("sendnewsletter.aspx", "mywindow", 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=no,width=450,height=200,top=100,left=100', 'true');
		}
	
		
