// Validation for numeric values.
function Validate(val)
{
	var i;
	i=parseInt(val.value)
	
	
	if(i.length==0 || isNaN(i) || i=="0"){
		alert('Please enter a valid quantity');
		val.focus();
		return;
		}
		
	if (isNaN(val.value)){	
		alert('Please enter a valid quantity');
		val.focus();
		return;
					
	} 
	
	if (val.value < 0) {
		alert('Please enter a valid quantity');
		val.focus();
		return;
	
	}
			
	val.value=Math.round(val.value);

}

function AssignDefault(val)
{
	var i;
	i=parseInt(val.value)
	
	if(i.length==0 || isNaN(i) || i=="0"){
		alert('Please enter a valid quantity');
		val.value=1;
		//val.focus();
		return;
		}
		
	if (isNaN(val.value)){	
		alert('Please enter a valid quantity');
		val.value=1;
		//val.focus();
		return;
					
	} 
	
	if (val.value < 0) {
		alert('Please enter a valid quantity');
		val.value=1;
		//val.focus();
		return;
	
	}
			
	val.value=Math.round(val.value);

}

function emailvalidation(TextBoxControl) 
   {   
   
     if (eval("document.forms[0].elements['" + TextBoxControl + "']").value.length==0)
    {
        alert('Email Field cannot be blank');
        eval("document.forms[0].elements['" + TextBoxControl + "']").focus();
        return false;
    }    
        var src=eval("document.forms[0].elements['" + TextBoxControl + "']").value; 
        var emailReg = "^[\\w-_\.]*[\\w-_\.]\@[\\w]\.+[\\w]+[\\w]$";
        var regex = new RegExp(emailReg);
        if (regex.test(src)) 
            {return true;}
        else  
            {  
                alert('Invalid Email ID!!!');
                window.document.forms[0].elements[TextBoxControl].focus();   
                return false;
            }  
            
     }
     



//+----------------------------------------------------------------------------
//
//  Function:       displayNugget
//
//  Description:    Alternately displays and hides the content of the nugget.
//
//  Arguments:      none
//
//  Returns:        nothing
//
//-----------------------------------------------------------------------------

function displayNugget(oNug)
{
	var e = oNug.all("disp");
	var f = oNug.all("content");
	
	
	//  If contents are hidden, show them
	if (f.style.display == "none") 
	{
		e.title = "Hide";
		e.children(0).src = "../images/Ecom/minus.gif";
		f.style.display = "block";
		display = "0";
		
	
	}	
	//  If contents are showing, hide them
	else
	{
		e.title = "Show";
		e.children(0).src = "../images/Ecom/plus.gif";
		f.style.display = "none";
		display = "1";
	
	}

}


function ShowPrice(strField){
		var ctrl;
		var values;
		var data=strField.value;
		values=data.split("~");
		ctrl=eval('Price_' + strField.id);
		ctrl.innerText= values[1];		
		
}


function ExpandAll(){
		var i;
		for(i=0;i<=document.forms[0].elements['ProdList:txtCount'].value;i++){
			var oNug=eval('Prod'+ i);
			var e = oNug.all("disp");
			var f = oNug.all("content");
			e.title = "Hide";
			e.children(0).src = "../images/Ecom/minus.gif";
			f.style.display = "block";
			display = "0";
		
		} 
}
	
	
function CollapseALL(){
		var i;
		for(i=0;i<=document.forms[0].elements['ProdList:txtCount'].value;i++){
		var oNug=eval('Prod'+ i);
		var e = oNug.all("disp");
		var f = oNug.all("content");
		e.title = "Show";
		e.children(0).src = "../images/Ecom/plus.gif";
		f.style.display = "none";
		display = "1";
		
	} 
}

function ShowVariantPrice(strField){
		var values;
		var data=strField.value;
		var ctrl1;
		ctrl1=document.forms[0].elements['txthidden'];
		values=data.split("~");
		ctrl1.value=values[0];
		ctrl=eval('prdDisplay__ctl1_lblPrice');
		ctrl.innerText= 'Price :' + values[1];
				
}

function DoPost(strField){
	var ctrl;
	ctrl= document.forms[0].elements['txtActionType'];
	ctrl.value=	strField
	document.Form1.submit();
}