function attribute_select(attr)
{
var inputs =document.getElementById(attr).getElementsByTagName('select');
 for (var i=0; i < inputs.length; i++) 
{

if(inputs[i].value=='Unspecified')
{
alert("Kindly Select Attribute value");
return false;
}

 }




}






function trim(_value)
{return _value.replace(/^\s+|\s+$/g,"");}
function valid_email(){
var newsletter_email=trim(document.getElementById("newsletter_email").value);
	if (newsletter_email.length == 0) 
	{
	alert("Kindly enter valid email-id.");
	return false;
	}
	if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(newsletter_email))) 
 	{
  	alert("Kindly enter valid email-id.");
	document.getElementById("newsletter_email").focus();
 	return (false);
    	}
	if(newsletter_email)
	{
		url = '/myshop/newsletter_email_check.php?action=newsletter_email&email='+newsletter_email+'&math='+Math.random();;
		http_request = false;
		if (window.XMLHttpRequest)
		{
			http_request = new XMLHttpRequest();
			if (http_request.overrideMimeType)
			{
				http_request.overrideMimeType('text/html');
			}
		}
		else if (window.ActiveXObject)
		{
			// IE
			try
			{
				http_request = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				try
				{
					http_request = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e)
				{
	
				}
			}
		}
		http_request.onreadystatechange = function() 
		{ 
			if (http_request.readyState == 4)
			{
				if (http_request.status == 200)
				{
				alert(http_request.responseText);
				document.getElementById("newsletter_email").value='Enter email';
				return false;
				}
			} 
		};
		http_request.open('GET', url, true);
		http_request.send(null);
	}
}
function show_table(tab)
{
document.getElementById(tab).className="d_table1";
}
function GetValue1()
{
if(document.cart_quantity.products_id.value=='0')
{
alert("Select Option Value");
return false;
}
if(document.cart_quantity.terms.checked == false)
{
alert("Kindly Select Term and Conditions.");
return false;
}
}
function GetValue(txt)
{
if(document.cart_quantity.products_id.value=='0')
{
alert("Select Option Value");
return false;
}
var myString=txt;
var mySplitResult = myString.split("X");
document.cart_quantity.cart_quantity.value=trim(mySplitResult[1]);
}
function giftcard_validation(img)
{
	for (var i=0; i < document.cart_quantity.products_id1.length; i++)
		{
			if (document.cart_quantity.products_id1[i].checked)
			{
				var code = document.cart_quantity.products_id1[i].value;
			}
		}
	if(code)
	{
         	url = '/myshop/value_calculate.php?action=validate_price&code='+code+'&math='+Math.random();
		
		http_request = false;
		if (window.XMLHttpRequest)
		{
			http_request = new XMLHttpRequest();
			if (http_request.overrideMimeType)
			{
				http_request.overrideMimeType('text/html');
			}
		}
		else if (window.ActiveXObject)
		{
			// IE
			try
			{
				http_request = new ActiveXObject("Msxml2.XMLHTTP");
			}
			catch (e)
			{
				try
				{
					http_request = new ActiveXObject("Microsoft.XMLHTTP");
				}
				catch (e)
				{
	
				}
			}
		}
		http_request.onreadystatechange = function() 
		{ 
			if (http_request.readyState == 4 )
			{
			if (http_request.status == 200)
			{
				
				
				if(code!=500)
				{
				document.getElementById('new').innerHTML=http_request.responseText;
				}
				else
				{
				document.getElementById('new').innerHTML="<input type=hidden name=products_id value=33509><input type=hidden name=cart_quantity value=1>";
				}
			}
		} 
		};
		http_request.open('GET', url, true);
		http_request.send(null);
	}
}
// add code for Gifts Voucher //
function show()
{
if(document.getElementById('div_info').style.display=="none")
{
document.getElementById('div_info').style.display="block";
}
else
{
document.getElementById('div_info').style.display="none";
}
}
function getv(val,val1)
{
document.quick_find.searchvalue.value = val;
document.quick_find.categories_id.value = val1;
document.getElementById('div_info').style.display="none";
}
function hide_table(tab)
{
document.getElementById(tab).className="d_table2";
}
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
condition = !(( (browserName.indexOf("Explorer") >=0 ) && (browserVer < 4) ) ||  ((browserName.indexOf("Netscape") >=0 ) && (browserVer < 2) ) ) ; 
if (condition == true  )
    CanAnimate = true;
else
    CanAnimate = false;
function openchild(thisurl, v_width, v_height,subwindow){
    if (v_width <= 0)   {
        v_width='500';
    }
    if (v_height <= 0)   {
        v_height='500';
    }
	if (subwindow='')
	{
		subwindow = 'subwindow';
	}
    if ( CanAnimate ){ 
        msgWindow=window.open( '' ,subwindow,'left=0,top=0,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=' + v_width + ',height=' + v_height);
        msgWindow.focus();
        msgWindow.location.href = thisurl;
    }
    else {
        msgWindow=window.open( thisurl,subwindow,'left=0,top=0,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=' + v_width + ',height=' + v_height);
    } 
}
function openchild1(thisurl){
if ( CanAnimate ){ 
        msgWindow=window.open( '' ,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=no,menubar=no,resizable=yes,width=355,height=390,top=10');
        msgWindow.focus();
        msgWindow.location.href = thisurl;
}
else {
        msgWindow=window.open( thisurl,'subwindow','toolbar=no,location=no,directories=no,status=yes,scrollbars=no,menubar=no,resizable=yes,width=355,height=390,top=10');
}       
}
function openchild2(thisurl){
if ( CanAnimate ){ 
        msgWindow=window.open( '' ,'childwin','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=500,height=450,top=10');
        msgWindow.focus();
        msgWindow.location.href = thisurl;
}
else {
        msgWindow=window.open( thisurl,'childwin','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=500,height=450,top=10');
}       
}
function check_advanced_search(kw)  {
  error = 0;
  if (kw.length < 3) {
    error_message = "Please enter atleast 3 characters for search";
    error = 1;
  }

  if (error == 1) {
    alert(error_message);
    return false;
  } else {
    return true;
  }
}
function goto_url(thisurl) {
	location.href = thisurl;
}
function openchild3(thisurl)
{
	if ( CanAnimate )
	{ 
        msgWindow=window.open( '' ,'childwin','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=520,height=375,top=10');
        msgWindow.focus();
        msgWindow.location.href = thisurl;
	}
	else 
	{
        msgWindow=window.open( thisurl,'childwin','toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,menubar=no,resizable=yes,width=520,height=375,top=10');
	}       
}
function empty_keywords()  {
	document.quick_search.keywords.value = '';
    return true;
}
function show()
{
if(document.getElementById('div_info').style.display=="none")
{
document.getElementById('div_info').style.display="block";
}
else
{
document.getElementById('div_info').style.display="none";
}
}
function getv(val,val1)
{
document.quick_find.searchvalue.value = val;
document.quick_find.categories_id.value = val1;
document.getElementById('div_info').style.display="none";
}
browserName = navigator.appName;
browserVer = parseInt(navigator.appVersion);
condition1 = (browserName.indexOf("Netscape") >=0 ) && browserVer > 2 ;
condition2 = (browserName.indexOf("Explorer") >= 0) && browserVer > 3
if (condition1 == true  || condition2 == true)
	CanAnimate = true;
else
    CanAnimate = false;

function itsover(passedvar) {
	if (CanAnimate)   
		passedvar.style.background="#FFFF99";
}
 
function itsout(passedvar) {
	if (CanAnimate)   
		passedvar.style.background="#FFFFFF";
}

function itsover1(passedvar) {
	if (CanAnimate)   
		passedvar.style.background="#FFFF99";
}
 
function itsout1(passedvar) {
	if (CanAnimate)   
		passedvar.style.background="#FFFFFF";
}
function check(){
var myWidth = 0, myHeight = 0;if( typeof( window.innerWidth ) == 'number' ) {
myWidth = window.innerWidth;myHeight = window.innerHeight;} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
myWidth = document.documentElement.clientWidth;myHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
myWidth = document.body.clientWidth;myHeight = document.body.clientHeight;}if (myWidth < 1024){document.getElementById('mainpage').style.width='1002px';}else{document.getElementById('mainpage').style.width='';}}function addEvent( obj, type, fn ){
if (obj.addEventListener){obj.addEventListener( type, fn, false );
}else if (obj.attachEvent){obj["e"+type+fn] = fn;
obj[type+fn] = function(){ obj["e"+type+fn]( window.event ); }
obj.attachEvent( "on"+type, obj[type+fn] );
}}addEvent(window, 'load', check);
addEvent(window, 'resize', check);
