﻿// JavaScript Document
	function OpenWindow(ref)
	{
		//window.location.href = (ref,'_self');
		window.location.href = ref;
	}


function ChangeShow(obj)
	{
		if(obj.value=='advertiserInfo')
		{
			advertiserInfo.style.display="";
			agencyInfo.style.display="none"; 
		}
		else if(obj.value=='agencyInfo')
		{
			advertiserInfo.style.display="none";
			agencyInfo.style.display="";		
		}
	}
function Showtable(obj)
	{
		if(obj.value=='1')
		{
			flowtable.style.display="";	
		}
		else{
				flowtable.style.display="none";
			}
	}
	
function doOnLoad()
{
	var currentUrl = window.location.pathname;
	if(currentUrl.indexOf("Dashboards") > 0)
	{
		switchDivs("dashboard1","dashboard2");	
	}
	else if(currentUrl.indexOf("Accounts") > 0)
	{
		switchDivs("account1","account2");
	}
	else if(currentUrl.indexOf("Contacts")>0)
	{
		switchDivs("contact1","contact2");	
	}
	else if(currentUrl.indexOf("IO") > 0)
	{
		switchDivs("io1","io2");	
	}
	else if(currentUrl.indexOf("Inventories")>0)
	{
		switchDivs("inventory1","inventory2");
	}
	else if(currentUrl.indexOf("Reports")>0)
	{
		switchDivs("report1","report2");
	}
	else if(currentUrl.indexOf("Admin")>0)
	{
		switchDivs("admin1","admin2");
	}
	else if(currentUrl.indexOf("PGA")>0)
	{
		switchDivs("pgaadmin1","pgaadmin2");
	}
	else if(currentUrl.indexOf("Proposal") > 0)
	{
		switchDivs("propsoal1","propsoal2");	
	}
}
function switchDivs(visibleDivid,hiddenDivid)
{
	document.getElementById(visibleDivid).style.visibility="hidden";
	document.getElementById(hiddenDivid).style.visibility="visible";	
}
	

//Select Tag
function selectTag(showContent,selfObj){
	// 操作标签
	var tag = document.getElementById("tags").getElementsByTagName("li");
	var taglength = tag.length;
	for(i=0; i<taglength; i++)
	{
		tag[i].className = "";
	}
	selfObj.parentNode.className = "selectTag";
	// 操作内容
	for(i=0; j=document.getElementById("tagContent"+i); i++)
	{
		j.style.display = "none";
	}
	document.getElementById(showContent).style.display = "block";
}


function OpenWin(obj)
{
	window.open("io_add.html","newwindow","width=350,height=150,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no top=350,left=500");
}
function OpenWin1(obj)
{
	window.open("io_add1.html","newwindow","width=350,height=180,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no top=350,left=500");
}

function OpenProposal_add()
{
	window.open("proposal_add.html","newwindow","width=350,height=150,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no top=350,left=500");
}
function OpenProposal_add1()
{
	window.open("proposal_add1.html","newwindow","width=350,height=150,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no top=350,left=500");
}

function CloseWin(obj){
	window.close();
	}
//io new change div
function changeDiv(imgDiv,changeDivid,imgdiv2)
{
		//document.getElementById("dashboard2").style.display="";
 	if(document.getElementById(changeDivid).style.display=="none")
	{ 
		  document.getElementById(changeDivid).style.display = "";
		  document.getElementById(imgDiv).style.display = "none";
		  document.getElementById(imgdiv2).style.display = "";
	}
	else
	{
		 document.getElementById(changeDivid).style.display = "none";
	   	 document.getElementById(imgDiv).style.display = "";
		 document.getElementById(imgdiv2).style.display ="none";
	}
			
}

//show dashboards img
function showDashooardTab()
{
	document.getElementById("dashboardTable").style.display = "";
	document.getElementById("dashboardImg").style.display ="none";
	document.getElementById("viewTabel").style.display="none";
	document.getElementById("viewgraph").style.display="";	
	}
function showDashooardImg()
{
	document.getElementById("dashboardTable").style.display = "none";
	document.getElementById("dashboardImg").style.display ="";
	document.getElementById("viewTabel").style.display="";
	document.getElementById("viewgraph").style.display="none";
	}
	

//inventory_definekey.....
function addTextbox(addinventorydiv)
{
	document.getElementById(addinventorydiv).style.display="";
}

function addTextbox(addinventorydiv1)
{
	document.getElementById(addinventorydiv1).style.display="";
}


/*第一种形式 第二种形式 更换显示样式*/
function setTab(m,n){
	 var tli=document.getElementById("menu"+m).getElementsByTagName("li");
	 var mli=document.getElementById("main"+m).getElementsByTagName("ul");
	 for(i=0;i<tli.length;i++)
	 {
		tli[i].className=i==n?"hover":"";
		mli[i].style.display=i==n?"block":"none";
	 }
}



