﻿// JScript File
function ValidateTellafriend()
{
var isvalid = true;
var Validate = new Array('Header1_txtFromMail','Header1_txtFriendMail');
if(!RequiredFieldWithBorder(Validate))
{
    isvalid = false;
}  
if(isvalid==true)
{
if(!EmailCheck('Header1_txtFromMail'))
        {
            isvalid = false;
        }
        if(!EmailCheck('Header1_txtFriendMail'))
        {
            isvalid = false;
        }
}
return isvalid;
}
function EmailCheck(Id)
{
	try
	{
		var reg1 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
		var reg2 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
		
		Value = trimAll(document.getElementById(Id).value)
		

		if(Value != '')
		{
		if(! reg1.test(document.getElementById(Id).value) || reg2.test(document.getElementById(Id).value))
		{
			CreateBorder(Id);
			return false
		}
		}
		ClearBorder(Id);
		return true
	}
	catch(e)
	{
		alert(e.toString())
		alert(e.message.toString())
		alert('8')
		return false 
	}
}
function Show()
    {
//        /* get the mouse left position */
//        var cart=document.getElementById("href_cart");
//        x = cart.offsetLeft;
//        /* get the mouse top position  */
//        y = cart.offsetTop;
//        /* display the pop-up */
//        var Popup=document.getElementById("divCart");
//        Popup.style.display="block";
//        /* set the pop-up's left */
//        Popup.style.left = x+'px';
//        /* set the pop-up's top */
//        Popup.style.top = y+'px';   
var coord=getlocation('href_cart');
    var ctrl=   document.getElementById('divCart');
    
    ctrl.style.visibility='';
//    ctrl.style.left   =coord[0]+'px';
//    ctrl.style.top    =coord[1]+'px';
    
    if(coord[0]>=window.screen.width)
        coord[0]=coord[0]-(window.screen.width-coord[0]);
    else
        coord[0]=coord[0]+150;
    ctrl.style.left   =coord[0]-287+'px';
    ctrl.style.top    =coord[1]+20+'px';   
    ctrl.style.display="block";  
    }
    /* this function hides the pop-up when
     user moves the mouse out of the link */
    function Hide()
    {
        /* hide the pop-up */
        var Popup=document.getElementById("divCart");
        Popup.style.display="none";
    }
function getlocation(objControl)
{
 var obj=document.getElementById(objControl);
 var curleft = curtop = 0;
 if (obj.offsetParent) 
    {
        curleft = obj.offsetLeft
        curtop = obj.offsetTop
        while (obj = obj.offsetParent)
        {
        curleft += obj.offsetLeft
        curtop += obj.offsetTop
        }
    }     
return [curleft,curtop];
}