function openEditorWindow (url)
{
    window.open(url,'edit','toolbar=0,location=0,status=0,menubar=0,scrollbars=0,resizable=1,width=1000,height=700');
}
function openDetailsWindow (url)
{
    window.open(url,'_blank','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=800,height=600');
}
function openPreviewWindow (url)
{
    window.open(url,'_blank','toolbar=0,location=0,status=0,menubar=0,scrollbars=1,resizable=1,width=800,height=600');
}
function frameLoad (frameObj)
{
	var start,stop,string;
	string = frameObj.contentWindow.document.location.search.toLowerCase();
	
	var tid = -1;
	start = string.lastIndexOf('tid=');
	if (start >= 0)
	{
		stop = string.indexOf('&',start + 4);
		if (stop < start + 4)
		{
			stop = string.length;
		}
		if (stop > start + 4)
		{
			tid = string.substr(start+4,stop-start-4);
		}
	}
	else
	{
		string = frameObj.contentWindow.document.location.pathname.toLowerCase();
		stop = string.lastIndexOf('.htm');
		if (stop >0)
		{
			start = string.lastIndexOf('_',stop);
			if (stop > start + 1)
			{
				tid = string.substr(start+1,stop-start-1);
			}
		}
	}
	selectTid(tid,frameObj.name);
}
function selectTid(tid,target)
{
	var myColl, myStrip, myTab, myTarget, myTid, partid, i, j;
	myColl = document.getElementsByTagName('tabstrip');
	var found = false;
	for (i=0;i<myColl.length;i++)
	{
		myStrip = myColl[i];
		myStrip.selectedIndex = -1;
		for (j=0;j<myStrip.numTabs;j++)
		{
			myTab = myStrip.getTab(j);
			
			myTarget = myTab.getAttribute("frmtarget");
			if(myTarget != null && target == myTarget)
			{
				myTid = myTab.getAttribute("tid");
				if (myTid == tid)
				{
					
					partid = myStrip.parentElement.getAttribute("tid");
					if (partid != null)
					{
						selectTid(partid,target);
					}
					myStrip.selectedIndex = j;
				}
			}
		}
	}
}
function clearFrame()
{
	if ((document.getElementById('oldAnvId')) && document.getElementById('oldAnvId').value != "")
		document.getElementById(document.getElementById('oldAnvId').value).selectedIndex = 0;
	document.getElementById('oldAnvId').value = ""
}
function loadFrame(droplistEl,url,anvId,user,tid,targetId)
{
	if ((anvId) && (anvId != document.getElementById('oldAnvId').value))
	{
		if ((droplistEl) && droplistEl.id != document.getElementById('selectedControlId').value)
		{
			if ((document.getElementById('selectedControlId')) && document.getElementById('selectedControlId').value != "")
				document.getElementById(document.getElementById('selectedControlId').value).selectedIndex = 0;
			document.getElementById('selectedControlId').value = droplistEl.id;
		}
		document.getElementById('oldAnvId').value = anvId;
		document.getElementById(targetId).src=url + '?Id=' + anvId + '&user=' + user + "&tid=" + tid;
		selectTid (tid,targetId);
	}
}
function ShowColorPicker(targetId)
{
	document.all[targetId].value = window.showModalDialog('../Color picker/ColorPicker.htm',document.all[targetId].value,'dialogHeight:455px;dialogWidth:370px;center:Yes;help:No;scroll:No;resizable:No;status:No;');
}
function loadMessage (id)
{
	document.getElementById(id).innerText = window.dialogArguments;
	window.returnValue = false;
}
function closeWindow (returnValue)
{
	window.returnValue = returnValue;
	window.close();
}
function performBackup(username)
{
		retval = window.showModalDialog('PerformBackup.aspx?user=' + username,'','dialogHeight:150px;dialogWidth:350px;center:Yes;help:No;scroll:No;resizable:No;status:No;')
		if (retval) closeWindow(true);
}
function toggleStyle(tag) {
    if (tag.toggled == true) {
        tag.className = tag.savedClass;
        tag.toggled = false;
    }
    else {
        tag.savedClass = tag.className;
        tag.className = tag.altclass;
        tag.toggled = true;
    }
}

