function checkbver()
{
	version=0;
	if (navigator.appVersion.indexOf("MSIE")!=-1)
	{
		temp=navigator.appVersion.split("MSIE")
		version=parseFloat(temp[1])
	}
	if (version < 6.0) 
	{
//		alert("This site requires Microsoft Internet Explorer 6.0 or better. You can download the latest version of the Internet Explorer from www.microsoft.com/ie.");
		return false;
	}
	return true;
}

function checkIE()
{
	version=0;
	if (navigator.appVersion.indexOf("MSIE")!=-1)
	{
		temp=navigator.appVersion.split("MSIE")
		version=parseFloat(temp[1])
	}
	if (version < 6.0) 
	{
		return false;
	}
	return true;
}

function alertNotIE()
{
	if (checkIE() == false)
	{
		alert("Rules Designer requires Microsoft Internet Explorer. Please check with us later this year to see if other browsers are supported.");
		return true;
	}		
	return false;
}

function sizetextfrm(innerDiv, outerDiv)
{
	innerDiv.style.left = parseInt(outerDiv.style.left)+1;
	innerDiv.style.width = parseInt(outerDiv.style.width)-2;
	innerDiv.style.top = parseInt(outerDiv.style.top)+1;
	innerDiv.style.height = parseInt(outerDiv.style.height)-2;
	outerDiv.style.visibility='visible';
	innerDiv.style.visibility='visible';
}

function showcopyright(cdiv)
{
	cdiv.style.fontFamily = "verdana";
	cdiv.style.fontSize = "10px";
	cdiv.style.color = "black";
	cdiv.innerHTML = "&#169; Copyright 2009 VDE Technologies, LLC &#149; All rights reserved ";
	var ww=window.document.body.clientWidth;
	if (ww < 800) ww = 800;
	cdiv.style.left = (ww - parseInt(cdiv.style.width))/2;
}

function showpolicies(cdiv, br)
{
	if (window.location.href.indexOf("brms.aspx") >= 0) return;
	if (br) cdiv.innerHTML += "<br>";
	cdiv.innerHTML += "&#149; <a target=rulelabplc href='/privacypolicy.aspx' style='color:black'>Privacy Policy</a> &#149; <a target=rulelabplc href='/brs/help/termsofuse.htm' style='color:black'>Terms of Use</a> &#149;";
}

function getEDurl(page)
{
	if (window.parent.location.href.toLowerCase().indexOf("localhost") >= 0)
		return "/brs/businessruleeditor/"+page;
	else
		return "/"+page;
}

function getACurl(page)
{
	if (window.parent.location.href.toLowerCase().indexOf("localhost") >= 0)
		return "/brs/AccountServices/"+page;
	else
		return "/"+page;
}

function getWSurl(page)
{
	if (window.parent.location.href.toLowerCase().indexOf("localhost") >= 0)
		return "/brs/website/"+page;
	else
		return "/"+page;
}

function navtopage(pagename, mitem, contentsp)
{
	if (window.parent.parent.document.all.RuleLabNetForm)
	{
		window.parent.parent.document.all.txtsrc.value = pagename;
		window.parent.parent.document.all.menuitem.value = mitem;
		window.parent.parent.document.all.contentspage.value = contentsp;
	
		window.parent.parent.document.all.RuleLabNetForm.submit();			
		return;	
	}
	else
	{
//		var menDoc = window.parent.parent.frames[1].document.all;

		window.parent.parent.frames[1].document.all.txtsrc.value = pagename;
		window.parent.parent.frames[1].document.all.menuitem.value = mitem;
		window.parent.parent.frames[1].document.all.contentspage.value = contentsp;

		window.parent.parent.frames[1].document.all.mainmenuform.submit();			
	}
}

function parentnavtopage(pagename, mitem, contentsp)
{
	window.parent.document.all.txtsrc.value = pagename;
	window.parent.document.all.menuitem.value = mitem;
	window.parent.document.all.contentspage.value = contentsp;

	window.parent.document.all.RuleLabNetForm.submit();			
}

function ondocpageload()
{
	try
	{
	if (window.parent.frames.length == 0 || 
		(window.parent.frames[0].name.toLowerCase() != "bannerframe" && window.parent.frames[0].name.toLowerCase() != "maintextframe"))
	{
		alert(window.parent.frames[0].name);

		window.location = getWSurl("default.aspx");
		return;
	}
	
	if (document.all.offerframe)
	{
		if (window.parent.location.href.indexOf("brms.aspx") >= 0)
		{		
			document.all.offerframe.width = 0;
			document.all.offerframe.height= 0;
		}
		else
			sizeofferfr(document.all.offerframe);
	}
	window.setTimeout("setcontsel()", 500);
	window.parent.parent.Init();
	}
	catch(e)
	{
		window.parent.parent.location = getWSurl("default.aspx");
	}
}

function sizeofferfr(fr)
{
	fr.width = 245;
	fr.height= 560;
}

function setcontsel()
{
	var title = window.document.title.toLowerCase();
	var contframe = window.parent.frames[window.parent.frames.length - 1];
	if (contframe.location.href.indexOf("Flowchart") > 0) return;
	
	var spans = contframe.document.all.tags("SPAN");

	for (i=0; i < spans.length; i++)
	{
		var lv = parseInt(spans[i].level);
		if (spans[i].id.toLowerCase() == title)
		{
			spans[i].style.color = "blue";
			spans[i].style.cursor = "normal";
		}
		else
		{
			if (lv == 0)
				spans[i].style.color = "black";	
			if (lv == 1)
				spans[i].style.color = "darkslategray";	
			if (lv > 1)
				spans[i].style.color = "dimgray";
				
			spans[i].style.cursor = "hand";
		}
	}
}

function openContextHelpTop()
{
    var strFeatures = "width=900,height=500,";
	strFeatures += "help:no,maximize:no,minimize:no,scrollbars:no,status:no";
    helpwin = window.open("ContextHelp.htm?page=architecture.htm", "rulelabcontexthelp", strFeatures);
    helpwin.focus();
}

function delspaces(s)
{
	var t = "";
	for (i=0; i < s.length; i++)
	{
		c = s.substring(i,i+1);
		if (c == ' ') continue;
		t += c;
	}
	return t;
}

function dispPopupFrame(pupdiv, ipre)
{
	var cornerW = 33;
	var cornerH = 26;
	var bottomH = 13;
	var dbottom = parseInt(pupdiv.style.height) - 2;
	var dright = parseInt(pupdiv.style.width) + 6;
	ipre = "/brs/img/frame/"+ipre;
	
	cornerbottomleft = document.createElement("img");
	pupdiv.appendChild(cornerbottomleft);
	cornerbottomleft.src = ipre+"_corner_bottom_left.gif";
	cornerbottomleft.style.position = "absolute";
	cornerbottomleft.style.left = -cornerW/3;
	cornerbottomleft.style.top = dbottom - cornerH/2; 
	cornerbottomleft.style.position = "absolute";
	cornerbottomleft.style.zIndex = 100000;

	cornerbottomright = document.createElement("img");
	pupdiv.appendChild(cornerbottomright);
	cornerbottomright.src = ipre+"_corner_bottom_right.gif";
	cornerbottomright.style.position = "absolute";
	cornerbottomright.style.left = dright - cornerW + 8;
	cornerbottomright.style.top = dbottom - cornerH/2; 
	cornerbottomright.style.position = "absolute";
	cornerbottomright.style.zIndex = 100000;

	bottom = document.createElement("img");
	pupdiv.appendChild(bottom);
	bottom.src = ipre+"_bottom.gif";
	bottom.style.position = "absolute";
	bottom.style.left = cornerW/2;
	bottom.style.top = dbottom + bottomH/2 - 4; 
	bottom.style.height = bottomH;
	bottom.style.width = parseInt(pupdiv.style.width) - cornerW;
	bottom.style.position = "absolute";
	bottom.style.zIndex = 100000;

	left = document.createElement("img");
	pupdiv.appendChild(left);
	left.src = ipre+"_left.gif";
	left.style.position = "absolute";
	left.style.left = cornerbottomleft.style.left;
	left.style.top = cornerW/2; 
	left.style.height = parseInt(pupdiv.style.height) - cornerH;
	left.style.width = 13;
	left.style.position = "absolute";
	left.style.zIndex = 100000;

	right = document.createElement("img");
	pupdiv.appendChild(right);
	right.src = ipre+"_right.gif";
	right.style.position = "absolute";
	right.style.left = dright - 8;
	right.style.top = left.style.top; 
	right.style.height = parseInt(pupdiv.style.height) - cornerH;
	right.style.width = 13;
	right.style.position = "absolute";
	right.style.zIndex = 100000;

	cornertopeft = document.createElement("img");
	pupdiv.appendChild(cornertopeft);
	cornertopeft.src = ipre+"_corner_top_left.gif";
	cornertopeft.style.position = "absolute";
	cornertopeft.style.left = cornerbottomleft.style.left;
	cornertopeft.style.top = -(cornerH/2) + 4; 
	cornertopeft.style.position = "absolute";
	cornertopeft.style.zIndex = 100000;

	cornertopright = document.createElement("img");
	pupdiv.appendChild(cornertopright);
	cornertopright.src = ipre+"_corner_top_right.gif";
	cornertopright.style.position = "absolute";
	cornertopright.style.left = dright - cornerW + 8;
	cornertopright.style.top = -(cornerH/2) + 4; 
	cornertopright.style.position = "absolute";
	cornertopright.style.zIndex = 100000;

	topfr = document.createElement("img");
	pupdiv.appendChild(topfr);
	topfr.src = ipre+"_top.gif";
	topfr.style.position = "absolute";
	topfr.style.left = cornerW/2;
	topfr.style.top = -9; 
	topfr.style.height = bottomH;
	topfr.style.width = parseInt(pupdiv.style.width) - cornerW;
	topfr.style.position = "absolute";
	topfr.style.zIndex = 100000;
}

function ShowContactVDEDemoComments()
{
	ShowContactVDE();
	document.all.democommentsdiv.style.visibility='visible';
}

function ShowContactVDE()
{
	dispPopupFrame(document.all.PanelContactVDE, "fb");
	document.all.PanelContactVDE.style.left = 200;
	document.all.democommentsdiv.style.visibility='hidden';
	onscrollShowCnt();
	document.all.ContactVDE_SendButton.style.visibility = 'visible';
	document.all.ContactVDE_SubjectTextBox.focus();
}
		
function HideContactVDE(conf)
{
	if (conf && document.all.ContactVDE_MsgBodyTextbox.value.length > 0)
	{
		conf = window.confirm("Are you sure you want to close the email box without sending? Click OK to close. Click Cancel to continue editing.");
		if (conf == false)
		{
			event.returnValue = false;
			return;
		}
	}

	document.all.PanelContactVDE.style.left = -2000;
	event.returnValue = false;
}
		
function onscrollShowCnt()
{
	if (parseInt(document.all.PanelContactVDE.style.left) > 0)
		window.scrollTo(0,0);
}

// links //
			function navtoservice()
			{
				navtopage('/brs/help/services.htm','RuleLab.Net Service','');
			}

			function navtosecurity()
			{
				navtopage('/brs/help/security.htm','documentation','/brs/help/doccontents.htm');
			}
			
			function navtostate()
			{
				navtopage('/brs/help/brestate.htm','documentation','/brs/help/doccontents.htm');
			}

			function navtoxpath()
			{
				navtopage('/brs/help/xpath.htm','documentation','/brs/help/doccontents.htm');
			}

			function navtovocab()
			{
				navtopage('/brs/help/vocabulary.htm','documentation','/brs/help/doccontents.htm');
			}

			function navtodesigner()
			{
				navtopage('/brs/help/rulesdesigner.htm','documentation','/brs/help/doccontents.htm');
			}

			function navtowebsvc()
			{
				navtopage('/brs/help/webservice.htm','documentation','/brs/help/doccontents.htm');
			}

			function navtobreassembly()
			{
				navtopage('/brs/help/breassembly.htm','documentation','/brs/help/doccontents.htm');
			}

			function navtobrecom()
			{
				navtopage('/brs/help/brecom.htm','documentation','/brs/help/doccontents.htm');
			}
			
			function navtoArchpage()
			{
				navtopage('/brs/help/architecture.htm','architecture','/brs/help/doccontents.htm');
			}

			function navtoIntrpage()
			{
				navtopage('/brs/help/introduction.htm','introduction','/brs/help/doccontents.htm');
			}
			
			function navtovoca()
			{
				navtopage('/brs/help/vocabulary.htm','documentation','/brs/help/doccontents.htm');
			}
			

			function navtoBLMpage()
			{
				navtopage('/brs/help/websiteblm.htm','documentation','/brs/help/doccontents.htm');
			}
			
			function navtoExpertpage()
			{
				navtopage('/brs/help/expertsystem.htm','documentation','/brs/help/doccontents.htm');
			}

