var currentcolor; //DataGrid行本来的颜色

function GetInfo(InputID,InputType){
	window.open("../FormInfo/EmployeeList.aspx?InputID=" + InputID + "&InputType=" + InputType,"_blank","width=400,height=320")
}

function GetDepartmentInfo(InputID,InputType){
	window.open("../FormInfo/DepartmentList.aspx?InputID=" + InputID + "&InputType=" + InputType,"_blank","width=400,height=300")
}

function GetMultiPersonInfo(InputInfo){
	window.open("../FormInfo/EmployeesList.aspx?InputInfo=" + InputInfo,"_blank","top=100,left=150,width=630,height=500")
}

function EmployeesSelectedItem(guid,name,operation){
	if(operation=="add")
	{
		if(document.forms(0).employee_guid.value=="")
		{
			document.forms(0).employee_guid.value+=guid
		}
		else
		{
			document.forms(0).employee_guid.value+="|"+guid
		}

		document.forms(0).submit();
	}
	else if(operation=="remove")
	{
		document.forms(0).employee_guid.value=document.forms(0).employee_guid.value.toLowerCase();
		guid=guid.toLowerCase();
		var r, re;
		re=guid;
		document.forms(0).employee_guid.value=document.forms(0).employee_guid.value.replace(re,"");	
		re=/^\|/;
		document.forms(0).employee_guid.value=document.forms(0).employee_guid.value.replace(re,"");		
		re=/\|$/;
		document.forms(0).employee_guid.value=document.forms(0).employee_guid.value.replace(re,"");		
		re=/\|\|/;
		document.forms(0).employee_guid.value=document.forms(0).employee_guid.value.replace(re,"|");	
		document.forms(0).submit();	
	}	
}

function MouseOver(Element)
{	
	currentcolor=Element.style.backgroundColor;
	Element.style.backgroundColor="#b7c4e2";
}

function MouseOut(Element)
{
	Element.style.backgroundColor=currentcolor;
}

function ClickRow(Element,InputId,InputType)
{			

	var c=InputType.split("|");
	var d=InputId.split("|");
	for (i=0;i<c.length;i++){
		switch(c[i].toLowerCase()){
				case "employee_cardid":				
					if (opener.document.getElementById(d[i])!=null){
						opener.document.getElementById(d[i]).value=Element.getAttribute("Id");
					}
					break;
				case "employee_name":				
					if (opener.document.getElementById(d[i])!=null){
						opener.document.getElementById(d[i]).value=Element.getAttribute("Name");
					}
					break;
				case "employee_guid":			
					if (opener.document.getElementById(d[i])!=null){
						opener.document.getElementById(d[i]).value=Element.getAttribute("Guid");
					}
					break;
				case "dept_name":				
					if (opener.document.getElementById(d[i])!=null){
						opener.document.getElementById(d[i]).value=Element.getAttribute("Name");
					}
					break;
				case "dept_guid":				
					if (opener.document.getElementById(d[i])!=null){
						opener.document.getElementById(d[i]).value=Element.getAttribute("Guid");
					}
					break;
			}	
	}
	self.close();
}
function SelectItem(Element,InputId,InputType)
{	
	var c=InputType.split("|");
	var d=InputId.split("|");
	for (i=0;i<c.length;i++)
	{		
		if (opener.document.getElementById(d[i])!=null){
			opener.document.getElementById(d[i]).value=Element.getAttribute(c[i]);
		}
	}
	try
	{
		opener.AfterListProj();
	}
	catch(e){}	
	self.close();
}
function NavigteToCRM(crm_whole_url){

	var para="";
	if (screen.width==1024){
		para="left=0,top=0,width=1024,height=768,resizable=yes";
	}else{
		para="left=0,top=0,width=800,height=600,resizable=yes";
	}
	window.open(crm_whole_url,"_blank",para)
}
function OnBeforeSave()
{
	return true;
} 
