/***********************************************
* Drop Down/ Overlapping Content
***********************************************/

function getposOffset(overlay, offsettype){
var totaloffset=(offsettype=="left")? overlay.offsetLeft : overlay.offsetTop;
var parentEl=overlay.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function overlayContent(curobj, subobjstr, opt_position){
if (document.getElementById){
var subobj=document.getElementById(subobjstr)
subobj.style.display=(subobj.style.display!="block")? "block" : "none"
var xpos=getposOffset(curobj, "left")+((typeof opt_position!="undefined" && opt_position.indexOf("right")!=-1)? -(subobj.offsetWidth-curobj.offsetWidth) : 0) 
var ypos=getposOffset(curobj, "top")+((typeof opt_position!="undefined" && opt_position.indexOf("bottom")!=-1)? curobj.offsetHeight : 0)
subobj.style.left=xpos+"px"
subobj.style.top=ypos+"px"
return false
}
else
return true
}

function overlayContentClose(subobj){
document.getElementById(subobj).style.display="none"
}
/*****Drop Down/ Overlapping Content***********
***********************************************/



/***********************************************
* Open New Window
***********************************************/
function newWindowFixed(url,title,w,h) //scrollbars=no,resizable=no
{
  window.open(url,title,"toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=no,resizable=no,width="+w+",height="+h+",left="+((window.screen.availWidth-(w+4))/2)+",top="+((window.screen.availHeight-(h+50))/2));
}

function newWindowFixedScroll(url,title,w,h) //scrollbars=yes,resizable=no
{
  myRef = window.open(url,title,"toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=no,width="+w+",height="+h+",left="+((window.screen.availWidth-(w+4))/2)+",top="+((window.screen.availHeight-(h+50))/2));
}


function viewticketInfo(pro_id,type,tab)
{
	switch (tab){	
	case 1: 
	newWindowFixedScroll('../common/cust_info.php?pro_id='+pro_id+'&type='+type+'&popup=1&t=1','',580,620);
	break;
	case 2: 
	newWindowFixedScroll('../common/emp_info.php?pro_id='+pro_id+'&type='+type+'&popup=1&t=2','',580,620);
	break;
	case 3: 
	newWindowFixedScroll('../common/ticket_info.php?pro_id='+pro_id+'&type='+type+'&popup=1&t=3','',580,620);
	break;
	case 4: 
	newWindowFixedScroll('../common/cust_add.php?pro_id='+pro_id+'&type='+type+'&popup=1&t=4','',580,620);
	break;
	case 5: 
	newWindowFixedScroll('../common/emp_add.php?pro_id='+pro_id+'&type='+type+'&popup=1&t=5','',580,620);
	break;
	case 6: 
	newWindowFixedScroll('../common/ticket_add.php?pro_id='+pro_id+'&type='+type+'&popup=1&t=6','',580,620);
	break;
	default : 
	newWindowFixedScroll('../common/ticket_view.php?pro_id='+pro_id+'&type='+type+'&popup=1','',580,620);
	}
	
	//newWindowFixedScroll('../common/ticket_info.php?pro_id='+pro_id+'&type='+type+'&popup=1','',580,620);
}


  function toggleClass(ID)
  {
		
		if (document.getElementById)
		{
			if ( document.getElementById(ID).className == "boxSelected")
			{
				document.getElementById(ID).className = "boxUnselected";
			}else if ( document.getElementById(ID).className == "boxUnselected")
			{
				document.getElementById(ID).className = "boxSelected";
			}
		}
		
	
  }	  
	 
	  
  function checkStatus(ID, type) {
		
	var tmp = ID+'_label';	 
  
	if (type ==1) {
		document.getElementById(ID).className='boxSelected';
	} else if (type ==2) {	  
		document.getElementById(ID).className='boxUnselected';
	} else if (type ==3) {
	//if the checkbox haven't checked, when mouse out will not highlight the label
		if ( !document.getElementById(ID).checked)
		{
			document.getElementById(tmp).className = "boxUnselected";
		} 
	}
  }
  
  
  
  function checkStatusRadioBtn(ID, type) {
		
	var tmp = ID+'_label';	 
  
	if (type ==1) {
		document.getElementById(ID).className='boxSelected';
	} else if (type ==2) {	  
		document.getElementById(ID).className='boxUnselected';
	} else if (type ==3) {
	//if the checkbox haven't checked, when mouse out will not highlight the label		
				
		if ( !document.getElementById(ID).checked)
		{
			document.getElementById(tmp).className = "boxUnselected";
		} 
	}
  }   

function showID(id)
{
	document.getElementById(id).style.display="block";
	//document.getElementById(id+"_btn").style.display="none";
}

function closeID(id)
{
	document.getElementById(id).style.display="none";
	//document.getElementById(id+"_btn").style.display="block";
}   
function clearValue(id)
{
	document.getElementById(id).value="";
}	
function clearInnerHTML(id)
{
	document.getElementById(id).innerHTML="";
}	
function showID_closeID(id) {
	if(document.getElementById(id).style.display=="block")
	{
		document.getElementById(id).style.display="none";
	} else {
		document.getElementById(id).style.display="block";			
	}
}

function showTip(oEvent,id) {
	//alert(id);	
	var oDiv = document.getElementById(id);
	oDiv.style.display = "BLOCK";
	oDiv.style.left = oEvent.clientX + 5;
	oDiv.style.top = oEvent.clientY + 5;
}

function hideTip(oEvent,id) {
	var oDiv = document.getElementById(id);
	oDiv.style.display = "NONE";
}
