// THIS IS FOR MOUSE OVER DYNAMIC HEART SHAPE IMAGE
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


// This is for My Amgad Menu
function mmLoadMenus() {
//*********************** FOR DIAMONDS
  if (window.mm_menu_0610172340_0) return;
    window.mm_menu_0610172340_0_1 = new Menu("Fancy Colored Diamonds",160,18,"arial",12,"#4A716B","#000000","#F7EFD6","#EEE9BF","left","middle",3,0,1000,-5,7,true,true,true,0,false,true);
    mm_menu_0610172340_0_1.addMenuItem("All diamond color categories","location='diamondmain.asp?MID=Diamonds'");
    //mm_menu_0610172340_0_1.addMenuItem("About Amgad","location='#'");
    mm_menu_0610172340_0_1.hideOnMouseOut=true;
    mm_menu_0610172340_0_1.bgColor='#82B4A5';
    mm_menu_0610172340_0_1.menuBorder=1;
    mm_menu_0610172340_0_1.menuLiteBgColor='#82B4A5';
    mm_menu_0610172340_0_1.menuBorderBgColor='#739284';

  window.mm_menu_0610172340_0 = new Menu("root",140,18,"arial",12,"#4A716B","#000000","#F7EFD6","#EEE9BF","left","middle",3,0,1000,-5,7,true,true,true,0,false,true);
  mm_menu_0610172340_0.addMenuItem(mm_menu_0610172340_0_1,"location='#'");
  mm_menu_0610172340_0.addMenuItem("Sets","location='sets.asp'");
  mm_menu_0610172340_0.addMenuItem("Matched Pairs","location='matched_pairs.asp'");
  mm_menu_0610172340_0.addMenuItem("Clearance Items","location='clearance.asp'");
  mm_menu_0610172340_0.addMenuItem("New Merchandise","location='New_Merchandise.asp'");

   mm_menu_0610172340_0.hideOnMouseOut=true;
   mm_menu_0610172340_0.childMenuIcon="images/arrows.gif";
   mm_menu_0610172340_0.bgColor='#82B4A5';
   mm_menu_0610172340_0.menuBorder=1;
   mm_menu_0610172340_0.menuLiteBgColor='#82B4A5';
   mm_menu_0610172340_0.menuBorderBgColor='#739284';

//************************** FOR PRECIOUS JEMS
  /* if (window.mm_menu1_0610172340_0) return;
  window.mm_menu1_0610172340_0 = new Menu("root",140,18,"arial",12,"#4A716B","#000000","#F7EFD6","#EEE9BF","left","middle",3,0,1000,-5,7,true,true,true,0,false,true);
 mm_menu1_0610172340_0.addMenuItem("Emeralds","location='emeralds.asp'");
  mm_menu1_0610172340_0.addMenuItem("Rubies","location='rubies.asp'");
  mm_menu1_0610172340_0.addMenuItem("Sapphires","location='sapphires.asp'");

   mm_menu1_0610172340_0.hideOnMouseOut=true;
   mm_menu1_0610172340_0.childMenuIcon="images/arrows.gif";
   mm_menu1_0610172340_0.bgColor='#82B4A5';
   mm_menu1_0610172340_0.menuBorder=1;
   mm_menu1_0610172340_0.menuLiteBgColor='#82B4A5';
   mm_menu1_0610172340_0.menuBorderBgColor='#739284';
 */  
//*********************** FOR JEWELRY   
   
  window.mm_menu1_0610172340_0 = new Menu("root",140,18,"arial",12,"#4A716B","#000000","#F7EFD6","#EEE9BF","left","middle",3,0,1000,-5,7,true,true,true,0,false,true);
  mm_menu1_0610172340_0.addMenuItem("Rings","location='Diamond_Rings.asp'");
  mm_menu1_0610172340_0.addMenuItem("Necklaces","location='necklaces.asp'");
  mm_menu1_0610172340_0.addMenuItem("Bracelets","location='bracelets.asp'");
  mm_menu1_0610172340_0.addMenuItem("Earrings","location='earrings.asp'");
  mm_menu1_0610172340_0.addMenuItem("Other Jewelry","location='other_jewelry.asp'");
  //mm_menu1_0610172340_0.addMenuItem("Settings","location='settings.asp'");

   mm_menu1_0610172340_0.hideOnMouseOut=true;
   mm_menu1_0610172340_0.childMenuIcon="images/arrows.gif";
   mm_menu1_0610172340_0.bgColor='#82B4A5';
   mm_menu1_0610172340_0.menuBorder=1;
   mm_menu1_0610172340_0.menuLiteBgColor='#82B4A5';
   mm_menu1_0610172340_0.menuBorderBgColor='#739284';   

//*********************** FOR CUSTOMER SERVICE   
   
  window.mm_menu2_0610172340_0 = new Menu("root",140,18,"arial",12,"#4A716B","#000000","#F7EFD6","#EEE9BF","left","middle",3,0,1000,-5,7,true,true,true,0,false,true);
  mm_menu2_0610172340_0.addMenuItem("Buyers Guide","location='buyingad.asp'");
  mm_menu2_0610172340_0.addMenuItem("Contact Amgad","location='contactmsg.asp'");
  mm_menu2_0610172340_0.addMenuItem("B2B Credit Application","location='bracelets.asp'");

   mm_menu2_0610172340_0.hideOnMouseOut=true;
   mm_menu2_0610172340_0.childMenuIcon="images/arrows.gif";
   mm_menu2_0610172340_0.bgColor='#82B4A5';
   mm_menu2_0610172340_0.menuBorder=1;
   mm_menu2_0610172340_0.menuLiteBgColor='#82B4A5';
   mm_menu2_0610172340_0.menuBorderBgColor='#739284';     
   
//*********************** FOR ABOUT AMGAD   
   
  window.mm_menu3_0610172340_0 = new Menu("root",140,18,"arial",12,"#4A716B","#000000","#F7EFD6","#EEE9BF","left","middle",3,0,1000,-5,7,true,true,true,0,false,true);
  mm_menu3_0610172340_0.addMenuItem("Purchase Policies","location='purchasepolicy.asp'");
  mm_menu3_0610172340_0.addMenuItem("Site Terms","location='siteterms.asp'");
  mm_menu3_0610172340_0.addMenuItem("Retail Partnership","location='#'");
  mm_menu3_0610172340_0.addMenuItem("Why Register?","location='whyregister.asp'");
  mm_menu3_0610172340_0.addMenuItem("Customer testimonials","location='testimonials.asp'");
  mm_menu3_0610172340_0.addMenuItem("Contact Amgad","location='contactmsg.asp'"); 	

   mm_menu3_0610172340_0.hideOnMouseOut=true;
   mm_menu3_0610172340_0.childMenuIcon="images/arrows.gif";
   mm_menu3_0610172340_0.bgColor='#82B4A5';
   mm_menu3_0610172340_0.menuBorder=1;
   mm_menu3_0610172340_0.menuLiteBgColor='#82B4A5';
   mm_menu3_0610172340_0.menuBorderBgColor='#739284';     

mm_menu_0610172340_0.writeMenus();
mm_menu1_0610172340_0.writeMenus();
mm_menu2_0610172340_0.writeMenus();
mm_menu3_0610172340_0.writeMenus();
//mm_menu4_0610172340_0.writeMenus();
} // mmLoadMenus()


// FOR CATEGORY
function submitform(frm) {	
	//if (frm.cmbpcat.value == "")  {
	//	alert("Please Select Parent Category.");
	//	frm.cmbpcat.focus();
	//	return false;
	//	}
	
	if (frm.category.value == "")  {
		alert("Please enter Category.");
		frm.category.focus();
		return false;
		}

	if (frm.description.value == "")  {
		alert("Please enter Description.");
		frm.description.focus();
		return false;
		}
	}

function deleteform(frm,post){
	if(confirm("Are you sure to Delete?")){
	  frm.method="Post";	
	  frm.action=post;
	  frm.submit();
	}
}

function ChooseStatus(frm,post){
	if(confirm("Are you sure?")){
	  frm.method="Post";	
	  frm.action=post;
	  frm.submit();
	}
}

// FOR DELETE PRODUCT
function submitdelfrm (id){
	if(confirm("Are you sure to delete?")){ 
	  document.frmworker.ID.value=id;
	  document.frmworker.submit();
	}  
}

// DELETE USERS
function deluser(){
	if(confirm("Delete this user?")){
		document.location.href="submitusermanagement.asp?modtype=del&id="+deluser.arguments[0]+"&umtype="+deluser.arguments[1]
	}
}
// DELETE ADMIN USERS IE PARTNER EMP ADMIN
function deladminuser(){
	if(confirm("Delete this user?")){
		document.location.href="submitadminusermanagement.asp?modtype=del&id="+deladminuser.arguments[0]+"&umtype="+deladminuser.arguments[1]
	}
}

// Validate while adding new products
function submitfrm(frm) {
	if (frm.Carat.value==""){
	  frm.Carat.value=0;
	  //alert("Carat is empty");
	  //return false;
	}	
	if (frm.ppcarat.value==""){
	  frm.ppcarat.value=0;
	  //alert("Price Per Carat is empty");
	  //return false;
	}
	if (frm.cpcarat.value==""){
	  frm.cpcarat.value=0;
	  //alert("Cost Per Carat is empty");
	  //return false;
	}	
	if ((frm.Description.value.length<1) || (frm.Description.value.length>8000)) {
		alert("Please enter a description with less than 8000 characters.");
		frm.Description.select();
		return false;
	}
	else if (frm.Price.value=="") {
		alert("Please enter a Price.");
		frm.Price.focus();
		return false;
	}	
	//else if (frm.CategoryName.options[frm.CategoryName.selectedIndex].value=="") {
	else if (frm.CategoryID.value=="") {
		alert("Please select a Category.");
		frm.CategoryID.focus();
		return false;
	}
	else {
		return true;
	}
}
// FOR TOTAL PRICE
function frmtotalprice(frm){
	if ((frm.Carat.value!="") && (frm.ppcarat.value!=""))
		frm.totalprice.value=(eval(frm.Carat.value)*eval(frm.ppcarat.value))
}

// FOR TOTAL COST
function frmtotalcost(frm){
	if ((frm.Carat.value!="") && (frm.cpcarat.value!=""))
		frm.totalcost.value=(eval(frm.Carat.value)*eval(frm.cpcarat.value))
}

function frmprofit(frm){
	if ((frm.totalprice.value!="") && (frm.totalcost.value!="")){		
		var ChkTDot=(eval(frm.totalprice.value)-eval(frm.totalcost.value))
		var ChkTDot1=ChkTDot+"";
		var ChkPosDot=ChkTDot1.indexOf(".");
		var ChkFVal=ChkTDot1.substring(0,ChkPosDot+3);
		frm.profit.value=ChkFVal;
		
		var ChkDot=(1-(eval(frm.totalcost.value)/eval(frm.totalprice.value)))
		var chkDot1=ChkDot+"";
		var pos=chkDot1.indexOf(".");
		var FVal=chkDot1.substring(0,pos+3);
		if ((frm.totalcost.value==0)&&(frm.totalprice.value==0))
		frm.profitp.value=0;
		else
		frm.profitp.value=FVal;
	}	
}


function assignusers(){
	var mybox = document.frmsearch;
	var mycount = 0;
	if (mybox.chkEmp.length>0){
		for (i=0;i<mybox.chkEmp.length;i++){
			if (mybox.chkEmp[i].checked)
				mycount=1 
			}
		}
	else{
		if (mybox.chkEmp.checked)
			mycount=1 
		}
	
	if (mycount==1){
		document.frmsearch.method="post";
		document.frmsearch.action="submitassign.asp?type="+assignusers.arguments[0]+"&e_id="+assignusers.arguments[1]+"&umtype="+assignusers.arguments[2];
		document.frmsearch.submit();
	
	}
		
	else
		alert("You must select atleast one user to assign");
}

function removeassignusers(){
	var mybox = document.frmworker;
	var mycount = 0;
	if (mybox.chkEmp.length>0){
		for (i=0;i<mybox.chkEmp.length;i++){
			if (mybox.chkEmp[i].checked)
				mycount=1 
			}
		}
	else{
		if (mybox.chkEmp.checked)
			mycount=1 
		}
	
	if (mycount==1){
		if(confirm("Click OK to remove users from Employee. Click Cancel to move Users to other Employee")){
			document.frmworker.method="post";
			document.frmworker.action="submitassign.asp?action=remove&type="+removeassignusers.arguments[0]+"&e_id="+removeassignusers.arguments[1]+"&umtype="+removeassignusers.arguments[2];
			document.frmworker.submit();}
		else {
			document.frmworker.method="post";
			document.frmworker.action="selectemployee.asp?action=reassign&type="+removeassignusers.arguments[0]+"&e_id="+removeassignusers.arguments[1]+"&umtype="+removeassignusers.arguments[2];
			document.frmworker.submit();}		
		
	
	}
		
	else
		alert("You must select atleast one user to remove");
}


function reassignusers(){
	var mybox = document.frmempassign;
	var mycount = 0;
	if (mybox.rdoEmp.length>0){
		for (i=0;i<mybox.rdoEmp.length;i++){
			if (mybox.rdoEmp[i].checked)
				mycount=1 
			}
		}
	else{
		if (mybox.rdoEmp.checked)
			mycount=1 
		}
	
	if (mycount==1){
			document.frmempassign.method="post";
			document.frmempassign.action="submitassign.asp?action=reassign&e_id="+reassignusers.arguments[0]+"&umtype="+reassignusers.arguments[1];
			document.frmempassign.submit();}
			
	else
		alert("You must select employee to assign");
}

function frmCheckSess(){
  	window.open(frmCheckSess.arguments[0],'','width=820 height=500 addressbars=no status=yes scrollbars=yes');
  	}
  	
function frmShowProductList(){  	
  	window.open(frmShowProductList.arguments[0],'','addressbars=no resizable=yes status=yes scrollbars=yes');
  	}  	
function frmSessionCheck(){
  if(confirm("If you are a registered member click OK to login OR click Cancel to register"))
  	window.location.href='login.asp?typ='+frmSessionCheck.arguments[0]+'&prod_id='+frmSessionCheck.arguments[1];
  else
  	//window.location.href='register.asp?type='+frmSessionCheck.arguments[0]+'&prod_id='+frmSessionCheck.arguments[1];
  	window.opener.location.href='register.asp'
  	window.opener.focus()
  	window.close()
}

function frmDiamondSessionCheck(){
  if(confirm("If you are a registered member click OK to login OR click Cancel to register"))
  	window.location.href='../login.asp?s='+frmDiamondSessionCheck.arguments[2]+'&typ='+frmDiamondSessionCheck.arguments[0]+'&prod_id='+frmDiamondSessionCheck.arguments[1];
  else
  	window.location.href='../register.asp?s='+frmDiamondSessionCheck.arguments[2]+'&type='+frmDiamondSessionCheck.arguments[0]+'&prod_id='+frmDiamondSessionCheck.arguments[1];
  	//window.opener.location.href='register.asp'
  	//window.opener.focus()
  	//window.close()
}

function frmGetSessionCheck(){
  if(confirm("If you are a registered member click OK to login OR click Cancel to register"))
  	window.location.href='login.asp?getp='+frmGetSessionCheck.arguments[0]+'&prod_id='+frmGetSessionCheck.arguments[1];
  else
  //	window.location.href='register.asp?getp='+frmGetSessionCheck.arguments[0]+'&prod_id='+frmGetSessionCheck.arguments[1];
  	window.opener.location.href='register.asp'
  	window.opener.focus()
  	window.close()  
}  

function frmGetDiamondSessionCheck(){
  if(confirm("If you are a registered member click OK to login OR click Cancel to register"))
  	window.location.href='../login.asp?s='+frmGetDiamondSessionCheck.arguments[2]+'&getp='+frmGetDiamondSessionCheck.arguments[0]+'&prod_id='+frmGetDiamondSessionCheck.arguments[1]+'&cid='+frmGetDiamondSessionCheck.arguments[3]+'&QID='+frmGetDiamondSessionCheck.arguments[4];
  else
  	window.location.href='../register.asp?s='+frmGetDiamondSessionCheck.arguments[2]+'&getp='+frmGetDiamondSessionCheck.arguments[0]+'&prod_id='+frmGetDiamondSessionCheck.arguments[1]+'&cid='+frmGetDiamondSessionCheck.arguments[3]+'&QID='+frmGetDiamondSessionCheck.arguments[4];
  //	window.opener.location.href='register.asp'
  //	window.opener.focus()
  //	window.close()  
} 

function dP_sContact(a){
  alert("You have already contacted for this item.");
}

function dP_sConfirm(a){
  alert("An item already exists in your favourite");
}

function frmNotSess(){
  	window.location.href('contactus.asp?type='+frmNotSess.arguments[0]+'&pid='+frmNotSess.arguments[1]);
}

function frmDiamondNotSess(){
  	window.location.href('../contactus.asp?s='+frmDiamondNotSess.arguments[2]+'&type='+frmDiamondNotSess.arguments[0]+'&pid='+frmDiamondNotSess.arguments[1]);
}


//Script for Validating Username and Password while Login
function frmCheck(){
  var strError="";
  if(document.frm.username.value=="")
    strError=strError+"\nUser Name Required";
  if(document.frm.password.value=="")
    strError=strError+"\nPassword Required";
  if(strError!=""){
    alert("Following fields are Invalid\n-----------------------------------------"+strError);
    return false;
  }
  else
    return true;
}

// ************* Script for removing items from favourite
function removeitem(id) {
	document.location = "updatecart.asp?f=delete&id=" + id
}

//************** script for changing password
function frmChangePassword(){
var strError="";
if(document.frm.oldpassword.value=="")
  strError=strError+"\nOld Password Required";
if(document.frm.newpassword.value=="")
  strError=strError+"\nNew Password Required";
if((document.frm.newpassword.value)!=(document.frm.cnewpassword.value))
  strError=strError+"\nPassword Not Matched";
if(strError=="")
  return true;
else{
  alert("Following fields are Invalid\n-----------------------------------"+strError);
  return false;	
  }  
}

//************** FOR BUYING A DIAMOND
function openCLARITY() {
  popupWin = window.open('pops/clarity.htm', 'clarity', 'scrollbars=yes,width=550,height=600,left=0,top=0')
}
function openCOLOR() {
  popupWin = window.open('pops/color.htm', 'color', 'scrollbars=yes,width=550,height=475,left=50,top=50')
}
function openCUT() {
  popupWin = window.open('pops/cut.htm', 'cut', 'width=550,height=400,left=100,top=100')
}
function openCARAT() {
  popupWin = window.open('pops/carat.htm', 'carat', 'width=550,height=350,left=150,top=150')
}

function MM_findObj(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function openImage(id) {
  popupWin = window.open('images.asp?id=' + id, 'images', 'scrollbars=yes,width=600,height=600,left=150,top=150')
}

//SCRIPT FOR MAIL TO FRIEND	
function submitfriendform() {
	if (!isEmail(document.frm.friendemail.value)) {
		alert("Please enter your Friend's Email Address.");
		document.frm.friendemail.select();
		return false;
		}
	else if (document.frm.subject.value == "")  {
		alert("Please enter Subject.");
		document.frm.subject.focus();
		return false;
		}
	else if (document.frm.pmes.value == "")  {
		alert("Please enter Personal Message.");
		document.frm.pmes.focus();
		return false;
		}
}

function isEmail(str) {
	// are regular expressions supported?
	var supported = 0;
	if (window.RegExp) {
		var tempStr = "a";
		var tempReg = new RegExp(tempStr);
		if (tempReg.test(tempStr)) supported = 1;
	}
	if (!supported) return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
		var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
		var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
		return (!r1.test(str) && r2.test(str));
}


function frmFrenClose(){
  setTimeout('nextpage()',5000);
}

function nextpage(){  
  window.location.href="diamond_detail.asp?mod=detail&id="+Strid;
}

function frmProdPost(){
   document.frmworker.method="Post";
   document.frmworker.action=frmProdPost.arguments[0];
   document.frmworker.submit();
}

function frmCat(){
   var VField=document.frm.select.value;
   vSplQuestion=VField.split("?");
   vBefQuestion=vSplQuestion[0];
   vAftQuestion=vSplQuestion[1];
   vSplAftQuestion=vAftQuestion.split("=");
   vBefAftQuestion=vSplAftQuestion[0];
   vAftAftQuestion=vSplAftQuestion[1];      
   document.frm.CID.value=vAftAftQuestion;   
   document.frm.method="Post";
   document.frm.action=vBefQuestion;
   document.frm.submit();
   //document.frm.method="Post";
   //document.frm.action=document.frm.select.value;
   //document.frm.submit();
}


function sortFavPost(){
   document.frmworker.method="Post";
   document.frmworker.action=sortFavPost.arguments[0];
   document.frmworker.submit();
}

function openCertificate(){
   document.frm.method="Post";
   document.frm.action=openCertificate.arguments[0];
   document.frm.submit();
}


function frmFavPostProduct(){
 	 var searchtype="advfav";
   document.frmworker.method="Post";
   document.frmworker.action=frmFavPostProduct.arguments[0]+"&searchtype="+searchtype;
   document.frmworker.submit();
}

function frmFavPost(){
	 var searchtype=""
	 if(document.frmworker.cmbCut.value!="" || document.frmworker.cmbcolor.value!="" || document.frmworker.cmblotnumber.value!="") 
	 	searchtype="advfav";
	 else
	 	searchtype="";
	 	
   document.frmworker.method="Post";
   document.frmworker.action=frmFavPost.arguments[0]+"&searchtype="+searchtype;
   document.frmworker.submit();
}

function filtersearch(){
	 document.frmworker.method="Post";
   document.frmworker.action=filtersearch.arguments[0];
   document.frmworker.submit();
}
function frmIndex(val1,val2){
   document.frm.CID.value=val2;	
   document.frm.method="Post";
   document.frm.action=frmIndex.arguments[0];
   document.frm.submit();
}

function frmIndexProduct(val1,val2,val3){
   document.frm.id.value=val3;
   document.frm.det.value=val2;
   document.frm.method="Post";
   document.frm.action=frmIndexProduct.arguments[0];
   document.frm.submit();
}

function frmIndexAdvProduct(val1,val2,val3,val4){
   document.frm.id.value=val3;
   document.frm.det.value=val2;
   document.frm.cid.value=val4;
   document.frm.method="Post";
   document.frm.action=frmIndexAdvProduct.arguments[0];
   document.frm.submit();
}

function frmSearch(val1,val2,val3){
   document.frm.s.value=val2;	
   document.frm.typ.value=val3;
   document.frm.method="Post";
   document.frm.action=frmSearch.arguments[0];
   document.frm.submit();
}


function editpinfogo(){
	//window.location.href="product.asp?tttype=prof&tttypenext=profnext"
  	window.open(editpinfogo.arguments[0],'EditWindow','width=820 height=650 addressbars=no status=yes scrollbars=yes');
  	}

function editinvinfogo(){
	  	window.open(editinvinfogo.arguments[0],'','width=820 height=650 addressbars=no status=yes scrollbars=yes,top=30,left=150');
  	}  	
  	
  	
function pinfogo(){
	return true;
}



function ShowCalander(xL,xT,calParam){
 document.all.CalFrame.src=calParam
 document.all.CalFrame.style.left=xL;
 document.all.CalFrame.style.top=xT;
 document.all.CalFrame.style.display="block"
}

function callreturn(){
if (document.frmworker.fname.value==""){
		alert("Enter First name")
		document.frmworker.fname.focus()
		return false;
	}
else	if (document.frmworker.lname.value==""){
		alert("Enter Last name")
		document.frmworker.lname.focus()
		return false;
	}
else	if (document.frmworker.cmbstate.value==""){
		alert("Please select State")
		document.frmworker.cmbstate.focus()
		return false;
	}		
else	if (document.frmworker.country.value==""){
		alert("Please select country")
		document.frmworker.country.focus()
		return false;
	}

else
return true;
}

function userassignlead(){
	var mybox = document.frmworker;
	var mycount = 0;
	if (mybox.chk.length>0){
		for (i=0;i<mybox.chk.length;i++){
			if (mybox.chk[i].checked)
				mycount=1 
			}
		}
	else{
		if (mybox.chk.checked)
			mycount=1 
		}
	
	if (mycount==1){
			document.frmworker.method="post";
			document.frmworker.action="submituserempassign.asp?actiontype=fromuser&e_id="+userassignlead.arguments[0];
			document.frmworker.submit();}
			
	else
		alert("You must select atleast one member to assign!");
}

function leadnewwindos(){
	window.open(leadnewwindos.arguments[0],'','width=980,height=500,scrollbars=yes,menubar=no,addressbar=no,status=no')
}

function BacktoAdvanceSearch(){
	document.location.href='lead.asp?mod=advSearch&query=pop&umtype=a&e_id='+BacktoAdvanceSearch.arguments[0]
}


function popnote(){
	window.open(popnote.arguments[0],'','width=580,height=400,scrollbars=yes,menubar=no,addressbar=no,status=no,top=50,left=100')
}
function changeall(){
	var counter="0";
	var addmyid="";
	if(document.frmworker.checkall.length>0){
		for(i=0;i<frmworker.checkall.length;i++){
			if(document.frmworker.checkall[i].checked){
				addmyid=document.frmworker.checkall[i].value+","+addmyid
				counter=1;}
				
			}
		}
	else{
		if(document.frmworker.checkall.checked)
			counter=1;
			addmyid=document.frmworker.checkall.value
	}
	if(counter=="0")	
		alert("You must select atleast one Product")
	else
		window.open(changeall.arguments[0]+'?addmyid='+addmyid,'','width=430,height=300,scrollbars=yes,menubar=no,addressbar=no,status=no')
	
}

function submitchangeall(){
	if(document.frm.cmbCategory.value=="")
		alert("Please select category")
	else{
	document.frm.method="post";
	document.frm.action="changeall.asp?modeaction=changed";
	document.frm.submit();}
}

function makemechecked(){
	if(document.frmworker.checkall.length>=2){
		for(i=0;i<document.frmworker.checkall.length;i++){
			if(document.frmworker.checkallbox.checked)
				document.frmworker.checkall[i].checked = 1;
			else
				document.frmworker.checkall[i].checked = 0;
		}
	}	
	else{
			if(document.frmworker.checkallbox.checked)
				document.frmworker.checkall.checked = 1;
			else
				document.frmworker.checkall.checked = 0;
	}
}

function opencom(){
	var strmy="";
	var counter = 0;
	for(j=0;j<document.frmFollowdetail.elements.length;j++){
		if(document.frmFollowdetail.elements[j].name="chk")
			counter++;
	}
	if(counter>0){
	if(document.frmFollowdetail.chk.length>1){
		for(i=0;i<document.frmFollowdetail.chk.length;i++){
			if (document.frmFollowdetail.chk[i].checked)
				strmy=document.frmFollowdetail.chk[i].value+","+strmy
			}
		}
	else
		strmy=document.frmFollowdetail.chk.value
		}
	
	window.open(opencom.arguments[0]+'&stopid='+strmy,'','addressbar=no,scrollbars=yes,width=430,height=280,status=no,top=50,left=100');
}

function opendia(){
	var strmy="";
	var counter = 0;
	for(j=0;j<document.frmFollowdetail.elements.length;j++){
		if(document.frmFollowdetail.elements[j].name="chk")
			counter++;
	}
	if(counter>0){
	if(document.frmFollowdetail.chk.length>1){
		for(i=0;i<document.frmFollowdetail.chk.length;i++){
			if (document.frmFollowdetail.chk[i].checked)
				strmy=document.frmFollowdetail.chk[i].value+","+strmy
			}
		}
	else
		strmy=document.frmFollowdetail.chk.value
		}
	
	window.open(opendia.arguments[0]+'&stopid='+strmy,'','addressbar=no,scrollbars=yes,width=600,height=500,status=no,top=50,left=100');
}

function callcheckbox(){
	var mystr=""
	if(document.frmFollowdetail.chk[callcheckbox.arguments[3]].checked)
		mystr="checked"
	else
		mystr="unchecked"

	window.location.href="submitcommunicate.asp?checkme=dcheck&u_id="+callcheckbox.arguments[0]+"&p_id="+callcheckbox.arguments[1]+"&stopid="+callcheckbox.arguments[2]+"&strcheckstatus="+mystr
	
}
function ViewEmail(logid){
	h=window.open('../cm/SentEmailLogView.asp?EmailLogId='+logid,'viewemail','addressbar=no,scrollbars=yes,width=450,height=500,status=no,top=0,left=0');
	h.focus();
}

function usermostvisted(){
	window.open(usermostvisted.arguments[0],'','addressbar=no,scrollbars=yes,width=350,height=280,status=no,top=50,left=100');
}

function frmPassword(){
  var strError="";
  if(document.frm.username.value=="")
    strError=strError+"\nUser Name Required";
  if(strError!=""){
    alert("Following fields are Invalid\n-----------------------------------------"+strError);
    return false;
  }
  else
    return true;
}


function checkrequestlogin(){
	if(document.frmrequestLogin.txtusername.value==""){
		alert("User name required")
		document.frmrequestLogin.txtusername.focus()
		return false;}
	if(document.frmrequestLogin.txtpwd.value==""){
		alert("Password required")
		document.frmrequestLogin.txtpwd.focus()
		return false;}
}

function checkrequestregister(){
	if(document.frmRequestRegister.txtfirstname.value==""){
		alert("First name required")
		document.frmRequestRegister.txtfirstname.focus()
		return false;}
	if(document.frmRequestRegister.txtlastname.value==""){
		alert("Last name required")
		document.frmRequestRegister.txtlastname.focus()
		return false;}
	if(document.frmRequestRegister.txtphone.value==""){
		alert("Telephone required")
		document.frmRequestRegister.txtphone.focus()
		return false;}
	if(document.frmRequestRegister.email.value==""){
		alert("Email required")
		document.frmRequestRegister.email.focus()
		return false;}
		
}
