

/*	function change_them(th)
	{
		document.getElementById("them").href = th+'.css'; 
	}
*/
function del_shop_cart_item(pid)
{
if (confirm("Are you sure you want to delete this item?")) 
{
	document.shop_cart.action="shoping_cart.asp";
	document.shop_cart.cart_item_id.value=pid;
	document.shop_cart.cart_action.value="delete";
	document.shop_cart.submit();
}
else { 
	return false;
}	

}
function cancel_code()
{
	document.shop_cart.action="shoping_cart.asp";
	document.shop_cart.discount_code.value="";
	document.shop_cart.cart_action.value="cancel code";
	document.shop_cart.submit();
}
function update_shop_cart_item()
{

	document.shop_cart.action="shoping_cart.asp";
	document.shop_cart.cart_item_id.value=0;
	document.shop_cart.cart_action.value="update";
	document.shop_cart.submit();

}
function product_detail(p_id)
{
	document.product_detail.product_id.value=p_id;
	document.product_detail.action="product_detail.asp";
	document.product_detail.submit();

}
function product_detail(p_id)
{
	document.product_detail.product_id.value=p_id;
	document.product_detail.action="product_review.asp";
	document.product_detail.submit();

}
function m_open(id_open,id_close,th)
{	
	var src_array=th.src.split("/");
	if(src_array[src_array.length-1]=="plus.gif")
	{
		
		th.src="images/minus.gif";
		var mytool_array=id_open.split("~");		
		for (i=0;i<=mytool_array.length-2;i++ )
		{			
			
			document.getElementById(mytool_array[i]).style.display="";
			var srcc_array=document.getElementById("img_"+mytool_array[i]).src.split("/");
			if(srcc_array[srcc_array.length-1]!="Bullet.gif")
			document.getElementById("img_"+mytool_array[i]).src="images/bullet.gif";
		}
	}
	else
	{
		th.src="images/plus.gif";
		var mytool_array=id_close.split("~");		
		for (i=0;i<=mytool_array.length-2;i++ )
		{
			document.getElementById(mytool_array[i]).style.display="none";
			
		}

	}
	
}
function product_zoom(iid,pid)
{	
	
	if (window.innerHeight && window.scrollMaxY) {// Firefox 
        yWithScroll = window.innerHeight + window.scrollMaxY; 
        xWithScroll = (window.innerWidth + window.scrollMaxX)-30; 
    } else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac 
        yWithScroll = document.body.scrollHeight; 
        xWithScroll = document.body.scrollWidth; 
    } else { // works in Explorer 6 Strict, Mozilla (not FF) and Safari 
        yWithScroll = document.body.offsetHeight; 
        xWithScroll = document.body.offsetWidth; 
    } 
	//arrayPageSizeWithScroll = new Array(xWithScroll,yWithScroll); 
    //alert( 'The height is ' + yWithScroll + ' and the width is ' + xWithScroll ); 
    //return arrayPageSizeWithScroll;   
	if (iid==1)
	  {
		document.getElementById("eiframe").height=500+"px";
		document.getElementById("eiframe").width=600+"px";
		document.getElementById("eiframe").src="product_imges.asp?product_id="+pid;
	  }
	if (iid==2)
	  {
		document.getElementById("eiframe").height=320+"px";
		document.getElementById("eiframe").width=600+"px";
		document.getElementById("eiframe").src="mail_to_friend.asp?product_id="+pid;
	  }
	  if (iid==3)
	  {
		document.getElementById("eiframe").height=320+"px";
		document.getElementById("eiframe").width=600+"px";
		document.getElementById("eiframe").src="send_feedback.asp?product_id="+pid;
	  }
	  
	  document.getElementById("tbgg").height=yWithScroll+"px";
	  document.getElementById("tbgg").width=xWithScroll+"px";
   	  document.getElementById("tbg").style.display="block";
}
function close_iframe(){
	parent.document.getElementById("tbg").style.display="none";
}

function shoping_cart(product_id)
{
	if(document.product_detail.product_qty.value <= 0 || document.product_detail.product_qty.value=="")
	{
		alert("Enter product quentity");
		document.product_detail.product_qty.focus();
	}
	else
	{
		document.product_detail.product_id.value=product_id
		document.product_detail.method="post";
		document.product_detail.action="shoping_cart.asp";
		document.product_detail.submit();
	}
}

function wish_list(product_id)
{
	document.product_detail.product_id.value=product_id
	document.product_detail.action="wishlist.asp";
	document.product_detail.submit();
}
function product_review(p_id)
{
	document.product_detail.method="post";
	document.product_detail.product_id.value=p_id;
	//document.product_detail.action="product_review.asp?category_id="+document.product_detail.product_id_query.value;
	document.product_detail.action="product_review.asp";
	document.product_detail.submit();
}
function menu_navigation(x,y)
{
	document.menu_nava.method="post";
	document.menu_nava.action=x;
	document.menu_nava.action_parameter.value=y;
	document.menu_nava.submit();

}
function menu_navigation_cat(x,y)
{
	document.menu_nava_cat.method="post";
	document.menu_nava_cat.action=x;
	document.menu_nava_cat.action_parameter_cat.value=y;
	document.menu_nava_cat.submit();

}
function product_detail_view(x)
{
	document.product_detail.method="post";
	document.product_detail.action=x;
	document.product_detail.submit();
}
function product_record_move(x,record,pages)
{
	document.product_detail.method="post";
	document.product_detail.action=x;
	document.product_detail.page.value=record;
	document.product_detail.pagesize.value=pages;
	document.product_detail.submit();
}



//**************** Digit Function**********************
// This Function Allows Only Digits (0-9) in Textbox.
//******************************************************

function digit(evt)
{
	var charCode = (evt.which) ? evt.which : event.keyCode
	if (charCode > 31 && (charCode < 48 || charCode > 57))
	{
		return false;
	}
	return true;
}

//******************* Instruction For Implementation ********************
//write this in your textbox tag : onkeypress="return digit(event)"
//***********************************************************************

//**************** Digit Function End **********************


//**************** Digit Function 1**********************
// This Function Allows Only Digits (0-9) and . in Textbox.
//******************************************************


function digit1(evt)
{
	var charCode = (evt.which) ? evt.which : event.keyCode
	if (charCode > 31 && charCode != 46 && (charCode < 48 || charCode > 57))
	{
		return false;
	}
	return true;
}

//******************* Instruction For Implementation ********************
//write this in your textbox tag : onkeypress="return digit1(event)"
//***********************************************************************

//**************** Digit Function 1 End **********************




//**************** Alpha Function**********************
// This Function Allows Only Alphabets (A-Z and a-z and blank space) in Textbox.
//******************************************************

function alpha(evt)
{
	var charCode = (evt.which) ? evt.which : event.keyCode
	if (charCode!=32 && (charCode < 65 || charCode > 90)&&(charCode < 97 || charCode > 122))
	{
		return false;
	}
	return true;
}

//******************* Instruction For Implementation ********************
//write this in your textbox tag : onkeypress="return alpha(event)"
//***********************************************************************

//**************** Alpha Function End **********************


//**************** Alphanumeric Function**********************
// This Function Allows Only Alphabets (A-Z and a-z and blank space) and Digits (0-9) in Textbox.
//******************************************************

function alphanumeric(evt)
{
	var charCode = (evt.which) ? evt.which : event.keyCode
	if ( charCode!=32 &&(charCode < 48 || charCode > 57) && (charCode < 65 || charCode > 90 ) && (charCode < 97 || charCode > 122))
	{
		return false;
	}
	return true;
}


//******************* Instruction For Implementation ********************
//write this in your textbox tag : onkeypress="return alphanumeric(event)"
//***********************************************************************

//**************** Alphanumeric Function End **********************


//**************** Email Function**********************
// This Function Valifdates Email address in textbox
//******************************************************
function email(obj)
{
	if(obj.value!="")
	{
		var email,AtPos,StopPos,Message
		email = obj.value
		AtPos = email.indexOf("@")
		StopPos = email.lastIndexOf(".")
		Message = ""		
		if (AtPos == -1 || StopPos == -1) 
		{
			Message = "Not a valid email address"
		}
		if (StopPos < AtPos) 
		{
			Message = "Not a valid email address"
		}
		if (StopPos - AtPos == 1) 
		{
			Message = "Not a valid email address"
		}
		if (Message!="")
		{
			alert(Message);
			obj.focus();
			return(false);
		}
	}
}


//******************* Instruction For Implementation ********************
//write this in your textbox tag : onBlur="return email(this)"
//***********************************************************************

//**************** Email Function End **********************


//**************** New Window **********************
// This Function Opens newwindow
//******************************************************

var win = null;
function NewWindow(mypage,myname,w,h,scroll)
{
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings =
	'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable=0,status=0'
	win = window.open(mypage,myname,settings)
}

//******************* Instruction For Implementation ********************
//write this :javascript:NewWindow('page link','page title',800,600,1)
//***********************************************************************

//**************** New window Function End **********************

//**************** Check pincode **********************
// This Function Checks pincode
//******************************************************

//function pin(obj)
//{
//	if (obj.value.length<6 && obj.value.length!=0)
//	{
//		alert("Please Enter 6 Digit Number.");
//		obj.focus();
//		return (false);
//	}
//}

//******************* Instruction For Implementation ********************
//write this : onBlur="javascript:pin(this);"
//***********************************************************************

//**************** check pincode Function End **********************

//**************** website addresscheck **********************
// This Function validate website address
//******************************************************
function webcheck(obj)
{
	if(obj.value!="")
	{
		var email,AtPos,StopPos,Message
		email = obj.value
		AtPos = email.indexOf("www")
		StopPos = email.lastIndexOf(".")
		Message = ""
		if (AtPos == -1 || StopPos == -1 || http == -1) 
		{
			Message = "Not a valid Website address"
		}
		
		if (StopPos < AtPos) 
		{
			Message = "Not a valid Website address"
		}
		if (StopPos - AtPos == 1) 
		{
			Message = "Not a valid Website address"
		}
		if (Message!="")
		{
			alert(Message);
			obj.focus();
			return(false);
		}
	}
}

function echeck(incomingString)
{
	if(trimSpace(incomingString).length == 0 || incomingString.search(/^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/g) == -1)
	{
		return false;
	}
	else
		return true;	
}
//******************* Instruction For Implementation ********************
//write this :javascript:onBlur="return webcheck(this)"
//set value="http://" of your textbox
//***********************************************************************
//**************** webcheck Function End **********************



//**************** uppercase ***************************
// This Function converts all characters to uppercase
//******************************************************

function uppercase(obj)
{
	obj.value=obj.value.toUpperCase();
}
//******************* Instruction For Implementation ********************
//write this :javascript:onKeyup="uppercase(this);"
//***********************************************************************



//**************** Maxlength in textarea ***************************
// This Function sets maxlength of text area
//******************************************************
function maxlength(obj,obj1)
{
	if(obj.value.length>obj1)
	{
		obj.value=obj.value.substring(0, obj1);	
	}
}
//******************* Instruction For Implementation ********************
//write this :javascript:onKeypress="maxlength(this,5);"
//***********************************************************************


