function setContextBorder()
{
	var context = window.document.getElementById("contextcontainer");
	if(context)
	{		
		if(context.innerHTML != "")
		{			
			window.document.getElementById("tdContentMain").style.borderRight = "1px solid #BABABA";
		}
	}
}
function seltab(n, total) 
{		
	var i = 1;
	var tempElement = document.getElementById("tab"+i);
	while(tempElement != null || i <= total)
	{
		if(tempElement != null)
		{
			document.getElementById("tab"+i).className = "tabstop";
			document.getElementById("text"+i).style.display = "none";
		}
		tempElement = document.getElementById("tab"+ ++i);
	}	
	document.getElementById("tab"+n).className = "tabstopsel";
	document.getElementById("text"+n).style.display = "inline";
}

function OpenWindow(url, w, h, attr)
{
	var m_attr = "toolbar=1,location=0,directories=0,status=0,menubar=yes,scrollbars=yes,resizable=yes";
	if (attr)
	{
		m_attr = attr;
	}	
	window.open(url, "", m_attr+",width="+w+",height="+h);
}

function PreviewImage(imageid, w, h, autoresize)
{
	OpenWindow("/Forms/PreviewImage.aspx?imageid="+imageid+"&autoresize="+autoresize, w, h, "toolbar=0,location=0,directories=0,status=0,menubar=no,scrollbars=yes,resizable=yes");
}

function PrintPage() {
	var loc = location.href;
	if (loc.indexOf("#")>0) {
		loc = loc.substring(0, loc.indexOf("#"));
	}
	var pri = "?print=1";
	if (loc.indexOf("?")>0) {
		pri = "&print=1";
	}
	OpenWindow(loc+pri, 760, 400);
}

function SendPage(id) {
	var loc = "/layouts/sendpage.aspx?pageid="+id;
	OpenWindow(loc, 320, 250, "toolbar=0,location=0,directories=0,status=0,menubar=no,scrollbars=no,resizable=no");
}

function CheckForm(form)
{
	if (form.from.value == "" || form.to.value == "")
	{
		if (form.from.value == "")
		{
			document.getElementById('error1').style.display = "inline";
		}
		if (form.to.value == "")
		{
			document.getElementById('error2').style.display = "inline";
		}
		return false;
	}
	else
	{
		return true;
	}
}

function SetPostAction(val)
{
	var sUrl = val;
	if (sUrl.indexOf("/")<0) {
		sUrl = "/forms/"+sUrl;
	}
	if (sUrl.indexOf(".aspx")<0) {
		sUrl = sUrl + ".aspx";
	}
	//var ctl = document.all["postaction"];
	//ctl.value = val;
	document.forms[0].action = sUrl;
}

function doSearch(fld, target) 
{
	location.href= target+'?search='+eval("document.forms[0]."+fld).value;
}

function doKeySearch(evt, fld, target) 
{	
	if (evt.keyCode==13) 
	{	
		window.document.forms[0].action = target + '?search=' + eval("document.forms[0]."+fld).value;	
		evt.returnValue = null;
		evt.cancelBubble = true;
		
		doSearch(fld, target);		
	}
	return false;
}

function Cancel()
{
	alert("ser");
	return false;
}