// JavaScript Document

//menu constructor
function menu(allitems,thisitem,startstate){ 
  callname= 'gl'+thisitem;
  divname='subglobal'+thisitem;  
  this.numberofmenuitems = allitems;
  this.caller = document.getElementById(callname);
  this.thediv = document.getElementById(divname);
  this.thediv.style.visibility = startstate;
}

function popWindow(url){
dataitem=window.open (url,"dataitem","width=300,height=300,status=0,toolbar=0,Scrollbars=1");
}


function signout() {
	var say=confirm("Do you realy want to Sign Out?");
	if(say==true)	{
		return true;
	}
	else {
		return false;
	}
}
//Delete operation..
function del() {
	var say=confirm("Do you realy want to delete this item?");
	if(say==true)	{
		return true;
	}
	else {
		return false;
	}
}

function onKeyPressBlockNumbers(e)
{
	var key = window.event ? e.keyCode : e.which;
	var keychar = String.fromCharCode(key);
	reg = /\d/;
	return reg.test(keychar);
}
 
 
function mypopupCustomer(url,win_name,ele)
 {
	//alert(url);
 mywindow = window.open (url,win_name,"location=1,status=1,scrollbars=1,width=500,height=370");
 return true;
 } 

 


 //Numeric Validation...
 function chkNumeric(strString)
   //  check for valid numeric strings	
   {
   var strValidChars = "0123456789.";
   var strChar;
   var blnResult = true;

   if (strString.length == 0) return false;

   //  test strString consists of valid characters listed above
   for (i = 0; i < strString.length && blnResult == true; i++)
      {
      strChar = strString.charAt(i);
      if (strValidChars.indexOf(strChar) == -1)
         {
         blnResult = false;
         }
      }
   return blnResult;
   }

function productView(id)
{
	win_name="smcus1"
	var path=""
	path ="popup1.php?module=productView&dono="+id+"&s_type=4"
	
	mywindow = window.open (path,win_name,"location=1,status=1,scrollbars=1,width=700,height=700");
	return true;
	
}


function openmypage(id)
{ 
//alert(document.getElementById("ddown").style.visibility);
document.getElementById("ddown").style.visibility = "hidden";
ajaxwin=dhtmlwindow.open("ajaxbox", "ajax", "external.php?equip_id="+id, "Equipment Availability", "width=450px,height=300px,left=300px,top=100px,resize=1,scrolling=1")
//ajaxwin.onclose=function(){return window.confirm("Do you Wants to Close ")} 
}

function openmypage2(id)
{ 
//alert(document.getElementById("ddown").style.visibility);
document.getElementById("ddown").style.visibility = "hidden";
ajaxwin=dhtmlwindow.open("ajaxbox", "ajax", "test.php?equip_id=", "Equipment Availability", "width=450px,height=300px,left=300px,top=100px,resize=1,scrolling=1")
//ajaxwin.onclose=function(){return window.confirm("Do you Wants to Close ")} 
}


function openmypage1(id)
{ 
//alert(document.getElementById("ddown").style.visibility);
document.getElementById("ddown").style.visibility = "hidden";
document.getElementById("ddown1").style.visibility = "hidden";
ajaxwin=dhtmlwindow.open("ajaxbox", "ajax", "external1.php?equip_id="+id, "Equipment Availability", "width=450px,height=300px,left=300px,top=100px,resize=1,scrolling=1")
//ajaxwin.onclose=function(){return window.confirm("Do you Wants to Close ")} 
}

function openmyhome(id)
{ 
//alert(document.getElementById("ddown").style.visibility);
document.getElementById("ddown").style.visibility = "hidden";
document.getElementById("ddown1").style.visibility = "hidden";
ajaxwin=dhtmlwindow.open("ajaxbox", "ajax", "external.php?equip_id="+id, "Equipment Availability", "width=450px,height=300px,left=300px,top=100px,resize=1,scrolling=1")
//ajaxwin.onclose=function(){return window.confirm("Do you Wants to Close ")} 
}


function Checkall(form){
for (var i = 1; i < form.elements.length; i++){
eval("form.elements[" + i + "].checked = form.elements[0].checked");
}
}

function del()
{
   for(i=0;i<document.form.check.length;i++)
	{
 	if(document.form.check[i].checked == false) 
	{
		alert("Please select message");
		return false;
	}
	}
	var say=confirm("Do you realy want to delete this Message ?");
	if(say==true)	{
		return true;
	}
	else {
		return false;
	}
}

 function category()
   {
            if(document.form1.equip_category.selectedIndex==5)
				{
					document.getElementById('other').style.display='';
					
					window.document.form1.others.focus();
				} 
			if(document.form1.equip_category.selectedIndex!=5)
				{
					document.getElementById('other').style.display='none';
					return false;
				} 	

   }
   
function convert()
{
 A=document.getElementById("invoice_price").value ;	
 B=document.getElementById("invoice_discount").value ;
 C=(A /100)*B ;
 D=A-C;
 document.getElementById("invoice_total").value=Math.round(D);
}

function wishFun(path)
{
	window.location=path;
}

