///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
var ie=document.all
var dom=document.getElementById
var ns4=document.layers
var calunits=document.layers? "" : "px"

var bouncelimit=32 //(must be divisible by 8)
var direction="up"

function initbox(){

if (!dom&&!ie&&!ns4)
return
crossobj=(dom)?document.getElementById("dropin").style : ie? document.all.dropin : document.dropin

scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
crossobj.top=scroll_top-250+calunits
crossobj.visibility=(dom||ie)? "visible" : "show"
dropstart=setInterval("dropin()",60)

}

function dropin(){
	
scroll_top=(ie)? truebody().scrollTop : window.pageYOffset
if (parseInt(crossobj.top)<100+scroll_top)
crossobj.top=parseInt(crossobj.top)+50+calunits
else{
clearInterval(dropstart)
bouncestart=setInterval("bouncein()",60)
}
}

function bouncein(){
crossobj.top=parseInt(crossobj.top)-bouncelimit+calunits
if (bouncelimit<0)
bouncelimit+=8
bouncelimit=bouncelimit*-1
if (bouncelimit==0){
clearInterval(bouncestart)
}
}

function dismissbox(){
if (window.bouncestart) clearInterval(bouncestart)
crossobj.visibility="hidden"
}

function redo(){

bouncelimit=32
direction="up"
initbox()
}

function truebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function edit_menu_blank(id)
{
	frm="menu_name"+id;
	if(document.getElementById(frm).value=="")
	{
		alert("Please Enter Menu Name");
		document.getElementById(frm).focus();
		return false;
	}
	frm="icon"+id;
	if(document.getElementById(frm).value=="")
	{
		alert("Please Select Display Icon");
		document.getElementById(frm).focus();
		return false;
	}
	
}
////////////////////////////////////////////////////////////////////////////////////////////////////////
function chack_menu_blank()
{
	if(document.create_menu.menu_name.value=="")
	{
		alert("Please Enter Menu Name");
		document.create_menu.menu_name.focus();
		return false;
	}
	if(document.create_menu.icon.value=="")
	{
		alert("Please Select Display Icon");
		document.create_menu.icon.focus();
		return false;
	}
	
}
//////////////////////////////////////////////////////////////////////////////////////////////////////////////
function same_val(val)
{
	frm1="newhidden_menu"+val;
	frm2="oldhidden_menu"+val;
	frm3="value_contain"+val;
	
	document.getElementById(frm1).value=document.getElementById(frm2).value;
	document.getElementById(frm3).value=1;
	
	
}
function change_val(val)
{
	frm1="newhidden_menu"+val;
	frm2="oldhidden_menu"+val;
	frm3="value_contain"+val;
	document.getElementById(frm1).value="-"+document.getElementById(frm2).value;
	document.getElementById(frm3).value=1;
		
}

function check_user_blank()
{
	
	if(document.create_user.group_type.value=="")
	{
		alert("Please Select Group Type");
		document.create_user.group_type.focus();
		return false;
	}
	
	if(document.create_user.group_type.value!=3)
	{
			if(document.create_user.first_name.value=="")
			{
				alert("Please Enter First Name");
				document.create_user.first_name.focus();
				return false;
			}
			if(document.create_user.sex.value=="")
			{
				alert("Please Select Gender");
				document.create_user.sex.focus();
				return false;
			}
			if(document.create_user.merital_status.value=="")
			{
				alert("Please Select Merital Status");
				document.create_user.merital_status.focus();
				return false;
			}
	}
	
	if(document.create_user.group_type.value==3)
	{
			if(document.create_user.first_name.value=="")
			{
				alert("Please Enter Company Name");
				document.create_user.first_name.focus();
				return false;
			}
			if(document.create_user.contact_person.value=="")
			{
				alert("Please Enter Contact Person Name");
				document.create_user.contact_person.focus();
				return false;
			}
			if(document.create_user.con_per_phone.value=="")
			{
				alert("Please Enter Contact Person Phone No")
				document.create_user.con_per_phone.focus();
				return false;
			}
			if(document.create_user.Service_id.value=="")
			{
				alert("Please Select Service")
				document.create_user.Service_id.focus();
				return false;
			}
	}
	
	
	if(document.create_user.login_id.value=="")
	{
		alert("Please Enter Login Id");
		document.create_user.login_id.focus();
		return false;
	}
	if(document.create_user.password.value=="")
	{
		alert("Please Enter Password");
		document.create_user.password.focus();
		return false;
	}
	
	if(document.create_user.repasswd.value=="")
	{
		alert("Please Enter Repassword");
		document.create_user.repasswd.focus();
		return false;
	}
	if(document.create_user.password.value!=document.create_user.repasswd.value)
	{
		alert("Please Enter Repassword Same Password");
		document.create_user.repasswd.select();
		return false;
	}
	
	if(document.create_user.email_id.value=="")
	{
		alert("Please Enter Email Id");
		document.create_user.email_id.focus();
		return false;
	}
	
	if(document.create_user.per_address.value=="")
	{
		alert("Please Enter Permanent Address");
		document.create_user.per_address.focus();
		return false;
	}
	if(document.create_user.city.value=="")
	{
		alert("Please Enter City Name");
		document.create_user.city.focus();
		return false;
	}
	if(document.create_user.state.value=="")
	{
		alert("Please Enter State");
		document.create_user.state.focus();
		return false;
	}
	if(document.create_user.country.value=="")
	{
		alert("Please Select Country");
		document.create_user.country.focus();
		return false;
	}
	
	
}
function create_dept()
{
	if(document.create_deptmnt.department_name.value=="")
	{
		alert("Please Enter Department Name! ");
		document.create_deptmnt.department_name.focus();
		return false;
	}
	/*if(document.create_deptmnt.contact.value=="")
	{
		alert("Please Select The Name Of Contact Person! ");
		document.create_deptmnt.contact.focus();
		return false;
	}*/
	if(document.create_deptmnt.desc_dep.value=="")
	{
		alert("Please Give The Description! ");
		document.create_deptmnt.desc_dep.focus();
		return false;
	}
}

function department_show(uid)
{
	//alert(uid);
	document.getElementById(uid).style.visibility="visible";
	return false;
}
function department_hid(uid)
{
	
	document.getElementById(uid).style.visibility="hidden";
	return false;
}
function show_hid(dept_id)
{
	//alert(dept_id);
	document.getElementById("dd"+dept_id).style.visibility="visible";
	//alert(dept_id);
	return false;
}
function xxx(dept_id)
{
	alert("dept="+dept_id);
	
}
function hiding_this(dept_id)
{
	
	document.getElementById("dd"+dept_id).style.visibility="hidden";
	return false;
}

function edit_user_blank(id)
{
	frm="first_name"+id;
	//alert(frm);
	if(document.getElementById(frm).value=="")
	{
		alert("Please Enter First Name");
		document.getElementById(frm).focus();
		return false;
	}
	frm="sex"+id;
	if(document.getElementById(frm).value=="")
	{
		alert("Please Select Gender");
		document.getElementById(frm).focus();
		return false;
	}
	frm="merital_status"+id;
	if(document.getElementById(frm).value=="")
	{
		alert("Please Select Merital Status");
		document.getElementById(frm).focus();
		return false;
	}
	frm="per_address"+id;
	if(document.getElementById(frm).value=="")
	{
		alert("Please Enter Permanent Address");
		document.getElementById(frm).focus();
		return false;
	}
	frm="city"+id;
	if(document.getElementById(frm).value=="")
	{
		alert("Please Enter City Name");
		document.getElementById(frm).focus();
		return false;
	}
	frm="state"+id;
	if(document.getElementById(frm).value=="")
	{
		alert("Please Select State");
		document.getElementById(frm).focus();
		return false;
	}
	frm="country"+id;
	if(document.getElementById(frm).value=="")
	{
		alert("Please Enter Country");
		document.getElementById(frm).focus();
		return false;
	}
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////

function movethis(fbox,tbox) {
	if(fbox.value==0)
	{
	  alert("Please Select The Department Head");
	  return false;
    }
var arrFbox = new Array();
var arrTbox = new Array();
var arrLookup = new Array();
var i;
for (i = 0; i < tbox.options.length; i++) {
arrLookup[tbox.options[i].text] = tbox.options[i].value;
arrTbox[i] = tbox.options[i].text;
}
var fLength = 0;
var tLength = arrTbox.length;
for(i = 0; i < fbox.options.length; i++) {
arrLookup[fbox.options[i].text] = fbox.options[i].value;
if (fbox.options[i].selected && fbox.options[i].value != "") {
arrTbox[tLength] = fbox.options[i].text;
tLength++;
}
else {
arrFbox[fLength] = fbox.options[i].text;
fLength++;
   }
}
arrFbox.sort();
arrTbox.sort();
fbox.length = 0;
tbox.length = 0;
var c;
for(c = 0; c < arrFbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrFbox[c]];
no.text = arrFbox[c];
fbox[c] = no;
}
for(c = 0; c < arrTbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrTbox[c]];
no.text = arrTbox[c];
tbox[c] = no;
   }

var finalval;
for (i = 0; i < document.assign_depthd.associate0.options.length; i++)
{   
	if(i==0)
	finalval = document.assign_depthd.associate0.options[i].value;
	else if(i>0)
	finalval += document.assign_depthd.associate0.options[i].value+'#';
}
document.assign_depthd.associate0.value = finalval;
document.assign_depthd.head_id.value = finalval;
document.assign_depthd.submit();
//alert(finalval);
}
///////////////////////////////////////////////////////////////////////////////////////


function move_dept_opp(fbox,tbox) {
	if(fbox.value==0)
	{
	  alert("Please Select The Department Operator");
	  return false;
    }
var arrFbox = new Array();
var arrTbox = new Array();
var arrLookup = new Array();
var i;
for (i = 0; i < tbox.options.length; i++) {
arrLookup[tbox.options[i].text] = tbox.options[i].value;
arrTbox[i] = tbox.options[i].text;
}
var fLength = 0;
var tLength = arrTbox.length;
for(i = 0; i < fbox.options.length; i++) {
arrLookup[fbox.options[i].text] = fbox.options[i].value;
if (fbox.options[i].selected && fbox.options[i].value != "") {
arrTbox[tLength] = fbox.options[i].text;
tLength++;
}
else {
arrFbox[fLength] = fbox.options[i].text;
fLength++;
   }
}
arrFbox.sort();
arrTbox.sort();
fbox.length = 0;
tbox.length = 0;
var c;
for(c = 0; c < arrFbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrFbox[c]];
no.text = arrFbox[c];
fbox[c] = no;
}
for(c = 0; c < arrTbox.length; c++) {
var no = new Option();
no.value = arrLookup[arrTbox[c]];
no.text = arrTbox[c];
tbox[c] = no;
   }

var finalval;
for (i = 0; i < document.assign_deptopp.associate0.options.length; i++)
{   
	if(i==0)
	finalval = document.assign_deptopp.associate0.options[i].value;
	else if(i>0)
	finalval += document.assign_deptopp.associate0.options[i].value+'#';
}
document.assign_deptopp.associate0.value = finalval;
document.assign_deptopp.opp_id.value = finalval;
document.assign_deptopp.submit();
//alert(finalval);
}
/////////////////////////////////////////////////////////////////////////////////////////
function assign_head()
	{
	  
	   if(document.assign_depthd.department.value=='')
		{
		alert('Please Select The Department Name');
		document.assign_depthd.department.focus();
		return false;
		}
		if(document.assign_depthd.associate1.value=='')
		{
		alert('Please Select The Department Head');
		return false;
		}
	}

function assign_head_opp()
	{
	if(document.assign_deptopp.department.value=='')
		{s
		alert('Please Select The department name');
		document.assign_deptopp.department.focus();
		return false;
		}
	}
////////////////////////////////////////////////////////////////////////////////////////////////

function show_hidden(dept_id)
{
	alert(dept_id);
	document.getElementById("dd"+dept_id).style.visibility="visible";
	//alert(dept_id);
	return false;
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
function edit_company_blank(cid)
{
	frm="company_name"+cid;
	if(document.getElementById(frm).value=="")
	{
		alert("Please Give Company Name ");
		document.getElementById(frm).focus();
		return false;
	}
	frm="company_code"+cid;
	if(document.getElementById(frm).value=="")
	{
		alert("Please Give Company Code");
		document.getElementById(frm).focus();
		return false;
	}
	frm="status"+cid;
	if(document.getElementById(frm).value=="")
	{
		alert("Please Select Status");
		document.getElementById(frm).focus();
		return false;
	}
	frm="first_add"+cid;
	if(document.getElementById(frm).value=="")
	{
		alert("Please Enter The Address Of Company");
		document.getElementById(frm).focus();
		return false;
	}
	frm="city"+cid;
	if(document.getElementById(frm).value=="")
	{
		alert("Please Enter City");
		document.getElementById(frm).focus();
		return false;
	}
	frm="state"+cid;
	if(document.getElementById(frm).value=="")
	{
		alert("Please Enter Name Of State");
		document.getElementById(frm).focus();
		return false;
	}
	frm="country"+cid;
	if(document.getElementById(frm).value=="")
	{
		alert("Please Enter Name Of Country");
		document.getElementById(frm).focus();
		return false;
	}
	frm="contact_name"+cid;
	if(document.getElementById(frm).value=="")
	{
		alert("Please Give The Name Contact Person");
		document.getElementById(frm).focus();
		return false;
	}
	frm="company_contact"+cid;
	if(document.getElementById(frm).value=="")
	{
		alert("Please Enter The Contact Number Of Company");
		document.getElementById(frm).focus();
		return false;
	}
	frm="email"+cid;
	if(document.getElementById(frm).value=="")
	{
		alert("Please Enter The E-mail Id Of Company");
		document.getElementById(frm).focus();
		return false;
	}
	frm="company_url"+cid;
	if(document.getElementById(frm).value=="")
	{
		alert("Please Enter URL Of Company");
		document.getElementById(frm).focus();
		return false;
	}
	frm="companylogo"+cid;
	if(document.getElementById(frm).value=="")
	{
		alert("Please Select The Company Logo");
		document.getElementById(frm).focus();
		return false;
	}
	
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

function branch_blank()
{
	if(document.create_branch.comany_id.value=="")
	{
		alert("Please Select Company  ");
		document.create_branch.comany_id.focus();
		return false;
	}
	
	if(document.create_branch.branch_name.value=="")
	{
		alert("Please Enter Branch Name");
		document.create_branch.branch_name.focus();
		return false;
	}
	if(document.create_branch.branch_code.value=="")
	{
		alert("Please Enter Branch Code");
		document.create_branch.branch_code.focus();
		return false;
	}
	if(document.create_branch.status.value=="")
	{
		alert("Please Select Status");
		document.create_branch.status.focus();
		return false;
	}
	if(document.create_branch.first_add.value=="")
	{
		alert("Please Enter Address");
		document.create_branch.first_add.focus();
		return false;
	}
	if(document.create_branch.city.value=="")
	{
		alert("Please Enter City");
		document.create_branch.city.focus();
		return false;
	}
	
	if(document.create_branch.state.value=="")
	{
		alert("Please Enter State");
		document.create_branch.state.focus();
		return false;
	}
	if(document.create_branch.country.value=="")
	{
		alert("Please Enter  Country");
		document.create_branch.country.focus();
		return false;
	}
	if(document.create_branch.contact_name.value=="")
	{
		alert("Please Enter Name Of Contact Person");
		document.create_branch.contact_name.focus();
		return false;
	}
	if(document.create_branch.branch_contact.value=="")
	{
		alert("Please Enter Contact no.");
		document.create_branch.branch_contact.focus();
		return false;
	}
	if(document.create_branch.branch_start_time.value== "")
	{
		alert("Please Enter Branch Opening Time");
		document.create_branch.branch_start_time.focus();
		return false;
	}
	if(document.create_branch.branch_start_time.value!= "")
	{
				   var wst=(document.create_branch.branch_start_time.value);
				   var mytool_array=wst.split(":");
				  var hour=mytool_array[0];
		  
		   var minut=mytool_array[1];
		   var second=mytool_array[2];
		 
		   if(hour>23|| hour<0)
		   {
				alert("Hour Is Not Valid");
				document.create_branch.branch_start_time.focus();
				return false;
		   }
		   
		   if(minut>59 || minut<0)
		   {
			   alert("Min Is Not Valid");
			   document.create_branch.branch_start_time.focus();
			   return false;
		   }
		   
			if(second)
			{
				 alert("Incorrect Time Format");
				 document.create_branch.branch_start_time.focus();
				 return false;
		   }
		   
			
		}
	if(document.create_branch.branch_end_time.value== "")
	{
		alert("Please Enter Branch Closing Time");
		document.create_branch.branch_end_time.focus();
		return false;
	}
	if(document.create_branch.branch_end_time.value!= "")
	{
				   var wst=(document.create_branch.branch_end_time.value);
				   var mytool_array=wst.split(":");
				  var hour=mytool_array[0];
		  
		   var minut=mytool_array[1];
		   var second=mytool_array[2];
		 
		   if(hour>23|| hour<0)
		   {
				alert("Hour Is Not Valid");
				document.create_branch.branch_end_time.focus();
				return false;
		   }
		   
		   if(minut>59 || minut<0)
		   {
			   alert("Min Is Not Valid");
			   document.create_branch.branch_end_time.focus();
			   return false;
		   }
		   
			if(second)
			{
				 alert("Incorrect Time Format");
				 document.create_branch.branch_end_time.focus();
				 return false;
		   }
		   
			
		}
	
}

function check_company()
{
	if(document.add_company.company_name.value=="")
	{
		alert("Please Give Company Name ");
		document.add_company.company_name.focus();
		return false;
	}
	
	if(document.add_company.company_code.value=="")
	{
		alert("Please Give Company Code");
		document.add_company.company_code.focus();
		return false;
	}
	if(document.add_company.status.value=="")
	{
		alert("Please Select Status");
		document.add_company.status.focus();
		return false;
	}
	if(document.add_company.first_add.value=="")
	{
		alert("Please Enter The Address Of Company");
		document.add_company.first_add.focus();
		return false;
	}
	if(document.add_company.city.value=="")
	{
		alert("Please Enter City");
		document.add_company.city.focus();
		return false;
	}
	if(document.add_company.state.value=="")
	{
		alert("Please Enter Name Of State");
		document.add_company.state.focus();
		return false;
	}
	
	if(document.add_company.country.value=="")
	{
		alert("Please Enter Name Of Country");
		document.add_company.country.focus();
		return false;
	}
	if(document.add_company.contact_name.value=="")
	{
		alert("Please Give The Name Contact Person");
		document.add_company.contact_name.focus();
		return false;
	}
	if(document.add_company.company_contact.value=="")
	{
		alert("Please Enter The Contact Number Of Company");
		document.add_company.company_contact.focus();
		return false;
	}
	if(document.add_company.email.value=="")
	{
		alert("Please Enter The E-mail Id Of Company");
		document.add_company.email.focus();
		return false;
	}
	
	if(document.add_company.company_url.value=="")
	{
		alert("Please Enter URL Of Company");
		document.add_company.company_url.focus();
		return false;
	}
	if(document.add_company.companylogo.value=="")
	{
		alert("Please Select The Company Logo");
		document.add_company.companylogo.focus();
		return false;
	}
	if(document.add_company.branch_start_time.value!= "")
	{
				   var wst=(document.add_company.branch_start_time.value);
				   var mytool_array=wst.split(":");
				  var hour=mytool_array[0];
		  
		   var minut=mytool_array[1];
		   var second=mytool_array[2];
		 
		   if(hour>23|| hour<0)
		   {
				alert("Hour Is Not Valid");
				document.add_company.branch_start_time.focus();
				return false;
		   }
		   
		   if(minut>59 || minut<0)
		   {
			   alert("Min Is Not Valid");
			   document.add_company.branch_start_time.focus();
			   return false;
		   }
		   
			if(second)
			{
				 alert("Incorrect Time Format");
				 document.add_company.branch_start_time.focus();
				 return false;
		   }
		   
			
		}
	if(document.add_company.branch_end_time.value!= "")
	{
				   var wst=(document.add_company.branch_end_time.value);
				   var mytool_array=wst.split(":");
				  var hour=mytool_array[0];
		  
		   var minut=mytool_array[1];
		   var second=mytool_array[2];
		 
		   if(hour>23|| hour<0)
		   {
				alert("Hour Is Not Valid");
				document.add_company.branch_end_time.focus();
				return false;
		   }
		   
		   if(minut>59 || minut<0)
		   {
			   alert("Min Is Not Valid");
			   document.add_company.branch_end_time.focus();
			   return false;
		   }
		   
			if(second)
			{
				 alert("Incorrect Time Format");
				 document.add_company.branch_end_time.focus();
				 return false;
		   }
		   
			
		}
	
}

///////////////////////////////To Check Blank Entry On Create Catagory Page///////////////////////////////////////////////////////
function create_category11()
{
	
	if(document.create_category.department_id.value=="")
	{
		alert("Please Select Service Name");
		document.create_category.department_id.focus();
		return false;
	}
	if(document.create_category.category_name.value=="")
	{
		alert("Please Enter Category Name");
		document.create_category.category_name.focus();
		return false;
	}
	
}
function create_category_sub()
{
	
	if(document.create_category.department_id.value=="")
	{
		alert("Please Select Parent Category");
		document.create_category.department_id.focus();
		return false;
	}
	if(document.create_category.category_name.value=="")
	{
		alert("Please Enter Sub Category Name");
		document.create_category.category_name.focus();
		return false;
	}
	
}

function check_Form()
{
  
 
  if(document.getElementById("c_name") && document.getElementById("c_name").value=="")
      {
		  alert("Please Select Client");
		   return false;
	  }
	 if(document.getElementById("id_client") && document.getElementById("id_client").value=="")
      {
		  alert("Please Select Client");
		  document.getElementById("id_client").focus();
		   return false;
	  }
	  
  if(document.getElementById("subject").value=="")
      {
		  alert("Please Enter Your Problem");
		  document.getElementById("subject").focus();
		  return false;
	  }
   
   if(document.getElementById("service_type").value=="")
      {
		  alert("Please select the service type");
		  document.getElementById("service_type").focus();
		  return false;
	  }
   
   if(document.getElementById("service_category").value=="")
      {
		  alert("Please select the service category");
		  document.getElementById("service_category").focus();
		  return false;
	  }
   
 	   if(document.getElementById("message").value=="")
      {
		  alert("Please Enter  Your Question");
		  document.getElementById("message").focus();
		  return false;
	  }
   
 }

function add(id ,sa)
{ 
	//alert(id);
	//alert(sa);
	ge = document.getElementById('choose_'+id); 
	if(document.getElementById(sa).checked)
	{
		//hideDiv(); 
		ge.style.display = "block"; 
		document.getElementById(sa).checked=="false";
	}
	if(document.getElementById(sa).checked=="")
	{
		ge.style.display = "none"; 
		document.getElementById(sa).checked=="false";
	}
} 
function edit(id,sa)
{ 
	ge = document.getElementById('choose_' + id); 
	if(document.getElementById(sa).checked)
	{
		//hideDiv(); 
		ge.style.display = "block"; 
		document.getElementById(sa).checked=="false";
	}
	if(document.getElementById(sa).checked=="")
	{
		
		ge.style.display = "none"; 
		document.getElementById(sa).checked=="false";
	}
} 
function del(id,sa)
{ 
	ge = document.getElementById('choose_' + id); 
	if(document.getElementById(sa).checked)
	{
		//hideDiv(); 
		ge.style.display = "block"; 
		document.getElementById(sa).checked=="false";
	}
	if(document.getElementById(sa).checked=="")
	{
	
		ge.style.display = "none"; 
		document.getElementById(sa).checked=="false";
	}
} 
function hideDiv(){ 
tag = document.getElementsByTagName("div"); 
for(x=0;x<tag.length; x++){ 

  if(document.getElementById('tag[x]'))
   {
   tag[x].style.display = "true";
   }
 
 if(tag[x].getAttribute('id').indexOf("choose_") == -1){ 
  tag[x].style.display = "block"; 
   } 
  } 
  alert(x);
} 


 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
 var horizontal_offset="9px" //horizontal offset of hint box from anchor link

/////No further editting needed

var vertical_offset="0" //horizontal offset of hint box from anchor link. No need to change.
var ie=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
if (whichedge=="rightedge"){
var windowedge=ie && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-30 : window.pageXOffset+window.innerWidth-40
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetWidth+parseInt(horizontal_offset)
}
else{
var windowedge=ie && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetHeight
}
return edgeoffset
}

function showhint(menucontents, obj, e, tipwidth){
if ((ie||ns6) && document.getElementById("hintbox")){
dropmenuobj=document.getElementById("hintbox")
dropmenuobj.innerHTML=menucontents
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (tipwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=tipwidth
}
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+obj.offsetWidth+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+"px"
dropmenuobj.style.visibility="visible"
obj.onmouseout=hidetip
}
}

function hidetip(e){
dropmenuobj.style.visibility="hidden"
dropmenuobj.style.left="-500px"
}

function createhintbox(){
var divblock=document.createElement("div")
divblock.setAttribute("id", "hintbox")
document.body.appendChild(divblock)
}

if (window.addEventListener)
window.addEventListener("load", createhintbox, false)
else if (window.attachEvent)
window.attachEvent("onload", createhintbox)
else if (document.getElementById)
window.onload=createhintbox



function validation_escalation()
{
	  if(document.getElementById("level_name").value=="")
      {
		  alert("Please Enter Level");
		  document.getElementById("level_name").focus();
		  return false;
	  }
   
   if(document.getElementById("esc_time").value=="")
      {
		  alert("Please Enter Time");
		  document.getElementById("esc_time").focus();
		  return false;
	  }
	  if(document.getElementById("level_no").value=="")
      {
		  alert("Please Enter Level");
		  document.getElementById("level_no").focus();
		  return false;
	  }
}
function zone_add()
{
  if(document.getElementById("zone_name").value=='')
  {
  	alert("Enter Zone Name");
	return false;
  }
}

 function design()
{

if(document.getElementById("department").value=='')
 {
  alert("Plese select  department ");
  document.getElementById("department").focus();
  return false;
 }

 if(document.form1.category_name.value=='')
 {
 alert("Plese enter designation name");
 document.form1.category_name.focus();
 return false;
 }
 return true;
}