/*function displaydiv()
{
	document.getElementById('div1').style.visibility='visible';	
}

function hidediv()
{
	document.getElementById('div1').style.visibility='hidden';	
}*/

function findPos(obj)
{
    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];
}


function Disp_DropDown(anchor_id,div_id)
{
	var browserName=navigator.appName;
	var width = screen.width;
	var height = screen.height;
	//alert(width+' and '+height);
/*	if(width==1024 || width==1152 || width==1280 || width==1360 || width==1366)
	{
*/		if(document.getElementById(anchor_id)!=null)
		{
			if(document.getElementById(div_id)!=null)
			{
				var oDiv = document.getElementById(div_id);
				var oAnchor = document.getElementById(anchor_id);
				var pos = findPos(oAnchor);
				oDiv.className = 'category-active';
				oAnchor.className = 'current';
				oDiv.style.position = 'absolute';
				//oDiv.style.left = pos[0]+20+'px';
				if (anchor_id == 'mens') {
					oDiv.style.left = pos[0]-167+'px';
				}
				else if (anchor_id == 'womens') {
					oDiv.style.left = pos[0]-165+'px';
				}
				else if (anchor_id == 'category') {
					oDiv.style.left = pos[0]-165+'px';
				}
				else {
					oDiv.style.left = pos[0]-165+'px';
				}
				if (anchor_id == 'mens' || anchor_id == 'womens' || anchor_id == 'category' ) {
					oDiv.style.top = pos[1]-54+'px';
				}				
				oDiv.style.zIndex = 1002;
				
				return false;
			}
		}
		
/*	}
*/		
	return false;
}
function Hide_DropDown(oAnchor,oDiv)
{
	//alert(oAnchor);
	if(document.getElementById(oAnchor)!=null) 
		document.getElementById(oAnchor).className ='normal';
	if(document.getElementById(oDiv)!=null) 
		document.getElementById(oDiv).className = 'category-hover';
	
	return false;
}


function EmailValidation(Element)
{
		Flag  = 1;
		count = 0;
	
		var alp = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_@.-";
		
		if(Element.value.length > 0)
		{
			for (var i=0; i<Element.value.length; i++)
			{
				temp = Element.value.substring(i, i+1);
	
				if (alp.indexOf(temp) == -1)
				{
					Flag = 0;
				}
			} // closing the for loop
		}
		else
		{
			Flag = 0;
		}
	
		for(var i=0; i <= Element.value.length; i++)
		{
			if(Element.value.charAt(0)=='@')
			{
				Flag = 0;
				break;
			}

			if(Element.value.charAt(Element.value.length-1)=='@')
			{
				Flag = 0;
				break;
			}

			if(Element.value.charAt(i)=='@') 
			{
				count = count + 1;

				if(count>1)
				{
					Flag = 0;
					break;
				}
			  
				if((Element.value.charAt(i-1)=='.') || (Element.value.charAt(i+1)=='.'))
				{
					Flag = 0;
					break;
				}
			}
			if(Element.value.indexOf('@')==-1)
			{
				Flag = 0;		    	
				break;
			}
			if(Element.value.charAt(0)=='.')
			{
				Flag = 0;
				break;
			}
			if(Element.value.indexOf('.')==-1)
			{
				Flag = 0;		    	
				break;
			}
		  } //closing the for loop
		
		if(Element.value.charAt(Element.value.length-1) == '.')
			Flag = 0;
			
		if(Flag != 1)
		{
			alert("Invalid Email Address.");
			Element.focus();
			return 0;
		}	
		else
			return 1;
	}
	


	function GenValidation(Element,MessageLen0,MessageLen4,spl) {
		
		if(MessageLen0.length != 0)
		{
			if(Element.value.length == 0)
			{
				alert("Please enter "+ MessageLen0);
				Element.focus();
				return 0;
			}
			else if(isBlank(Element.value))
			{
				alert("Please enter "+ MessageLen0);
				Element.focus();
				return 0;
			}
		}
	
		if(MessageLen4.length != 0)
		{
			if(Element.value.length < 4)
			{
				alert( MessageLen4 + " should be more than 4 characters");
				Element.focus();
				return 0;
			} // closing the if - else condtion for if(MessageLen4.length != 0)
		}
	
		if(spl == "spl")
		{
			if(SplCharacters(Element) == 0)
			return 0;
		}
		else if(spl == "space")
		{
			if(SplCharactersSpace(Element) == 0)
			return 0;
		}
		else if(spl == "nospace")
		{
			if(SplCharactersNoSpace(Element) == 0)
			return 0;
		}
		
	} // closing the function GenValidation()
	
	
	/**
	 FUNCTION SPLCHARACTERS(element) 
	 **/
	
	function SplCharacters(Val) {
	
	/***	updated by faiz***/
		//var alp = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789_";
		
		var alp = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ";
	/*************************************/
		for (var i=0;i<Val.value.length;i++){
			temp=Val.value.substring(i,i+1);
			if (alp.indexOf(temp)==-1){
				alert("No special characters \nValid entries are [a-z][A-Z][ ]");
				Val.focus();
				return 0;
			}
		} // closing the for loop
	
	} // closing the function SplCharacters()
	
	/**
	 FUNCTION SPLCHARACTERS(element) 
	 **/
	
	function SplCharactersSpace(Val)
	{
		var alp = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ";
	
		for (var i=0;i<Val.value.length;i++){
			temp=Val.value.substring(i,i+1);
			if (alp.indexOf(temp)==-1){
				alert("No special characters \nValid entries are [a-z][A-Z][0-9][ space ]");
				Val.focus();
				return 0;
			}
		} // closing the for loop
	} // closing the function SplCharactersSpace()
	
	function SplCharactersNoSpace(Val)
	{
		var alp = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789.";
		alert('fasdfad');
		for (var i=0;i<Val.value.length;i++){
			temp=Val.value.substring(i,i+1);
			if (alp.indexOf(temp)==-1){
				alert("No special characters \nValid entries are [a-z][A-Z][0-9][.]");
				Val.focus();
				return 0;
			}
		} // closing the for loop
	} // closing the function SplCharactersNoSpace()
	
	/**
	 FUNCTION SPLNUMBERS(element) 
	 **/
	
	function SplNumbers(Val)
	{
		var alp = "0123456789,.";
	
		for (var i=0;i<Val.value.length;i++){
			temp=Val.value.substring(i,i+1);
			if (alp.indexOf(temp)==-1){
				alert("No special characters except , and decimal point \nValid entries are [0-9][ , . ]");
				Val.focus();
				return 0;
			}
		} // closing the for loop
	
	} // closing the function SplNumbers()
	
	function OnlyNumbers(Val)
	{
		var alp = "0123456789-()";
	
		for (var i=0;i<Val.value.length;i++){
			temp=Val.value.substring(i,i+1);
			if (alp.indexOf(temp)==-1){
				alert("No special characters.Valid entries are [0-9][-][()]");
				Val.focus();
				return 0;
			}
		} // closing the for loop
	
	} // closing the function SplNumbers()

	function TextareaValidation(elem,msg,len) {
	
		   if(elem.value.length > 0)
		   {
			
			 if(elem.value.length > len) 
			{
				alert(msg+" should not exceed "+len+" characters");
				elem.focus();
				return 0;
			}	
			else
			{
					return 1;
			}
		   
		   }
		   else
		   {
			   	alert("Please Enter "+ msg);
				return 0;
		   }
		
	} 
	
	
	function namevalidation(Val,charr)
	{
		if(Val.value=='')
		{
			alert('Please enter the '+charr);
			Val.focus();
			return false;
		}
		var alp = "!abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ ";
		for (var i=0;i<Val.value.length;i++)
		{
			temp=Val.value.substring(i,i+1);
			if (alp.indexOf(temp)==-1)
			{
				alert("No special characters in "+charr+" \nValid entries are [a-z][A-Z][space]");
				Val.focus();
				return 0;
			}
		} // closing the for loop
	} //


