var detect = navigator.userAgent.toLowerCase();
var OS,browser,version,total,thestring, strVersion;
var strCode;
var strSUP, strUL, strLI

if (checkIt('konqueror'))
{
	browser = "Konqueror";
	OS = "Linux";
}
else if (checkIt('safari')) browser = "Safari"
else if (checkIt('omniweb')) browser = "OmniWeb"
else if (checkIt('opera')) browser = "Opera"
else if (checkIt('webtv')) browser = "WebTV";
else if (checkIt('icab')) browser = "iCab"
else if (checkIt('msie')) browser = "Internet Explorer"
else if (checkIt('fire')) browser = "Fire Fox"
else if (!checkIt('compatible'))
{
	browser = "Netscape Navigator"
	version = detect.charAt(8);
}
else browser = "An unknown browser";

if (!version) version = detect.charAt(place + thestring.length);

if (!OS)
{
	if (checkIt('linux')) OS = "Linux";
	else if (checkIt('x11')) OS = "Unix";
	else if (checkIt('win')) OS = "Windows";
	else if (checkIt('312.5')) OS = "OldMac";
	else if (checkIt('312.6')) OS = "OldMac2";
	else if (checkIt('mac')) OS = "Mac";
	else OS = "an unknown operating system";
}

function checkIt(string)
{
	place = detect.indexOf(string) + 1;
	thestring = string;
	return place;
}

//BUILT-IN MM functionality for preloading images
//Used to swap images back to their original state
//after mouse rollover
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

   function MM_preloadImages() { //v3.0
   var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function printContent()
{
	if (document.getElementById!= null) 
	{ 
		var html = '<HTML>\n<HEAD>\n'; 

		if (document.getElementsByTagName!= null) 
		{ 
			var headTags = document.getElementsByTagName("head"); 
			if (headTags.length > 0) 
			html += headTags[0].innerHTML; 
		} 
		html += '<link href="../css/styles.css" rel="stylesheet" type="text/css" />';
		html += '\n</HE' + 'AD>\n<BODY>\n'; 
		html += '<div id="topheader" style="height:38px;">'
		html += '<table width="800"><TR  background="#00386b"><TD><img src="../images/global/Logo_Long_Print_Page.gif" width="800" height="38"></TD></TR></table></div>'
		html += '<div id="print-content-div" class="regular-text" style="height:700px; background-color:#FFFFFF; width:800px;">'
		html += '<table width="794" cellpadding="0" cellspacing="0" border="0" class="regular-text"><TR><TD width="20">&nbsp;</TD><TD width="754"><BR>'
		var printPageElem = document.getElementById("content"); 
		
		//html += '<span class="regular-text">';
		
		if (printPageElem!= null) 
		{ 
			html += printPageElem.innerHTML; 
		} 
		else 
		{ 
			return; 
		} 
		
		//html += '</span>';
		
		//html += '<br>';
		//html += '</div>';
		html += '<BR><BR></TD><TD width="20">&nbsp;</TD></table>';
		html += '</div>';
		html += '<div id="bottomnav-print" style="border:1px;">'
		html += '<table width="800" cellpadding="0" cellspacing="0" border="0" class="bottom-links-print">'
		html += '<TR>'
		html += '<TD align="center">'
		html += '<table cellpadding="0" cellspacing="0" border="0" class="bottom-links-print">'
		html += '<tr>'
		
		html += '<td align="center" valign="top"><a href="../why/default.aspx">WHY YOU NEED US</a>&nbsp;|&nbsp;</td>'
		html += '<td align="center" valign="top"><a href="../casestudies.aspx">CASE STUDIES</a>&nbsp;|&nbsp;</td>'
		html += '<td align="center" valign="top"><a href="../services/default.aspx">CAPABILITIES</a>&nbsp;|&nbsp; </td>'
		html += '<td align="center" valign="top"><a href="../company/default.aspx">COMPANY</a>&nbsp;|&nbsp;</td>'
		html += '<td align="center" valign="top"><a href="../contact/default.aspx">CONTACT</a></td></tr></table>'
		html += '<table cellpadding="0" cellspacing="0" border="0" class="bottom-links">'
		html += '<tr>'
		html += '<td class="copyright">Copyright 2008 ChannelReady Inc.</td></tr></table></TD></TR></table>'
		html += '\n</BO' + 'DY>\n</HT' + 'ML>'; 
		html += '</div>';
		
	var printWin = window.open("","printFriendly", "toolbars=0, width=820"); 
		printWin.document.open(); 
		printWin.document.write(html); 
		printWin.print();
		printWin.document.close(); 
	
	} 
	else 
	{ 
		alert("Sorry, the printer friendly feature works\nonly in javascript enabled browsers."); 
	} 
} 

	
function OpenPopup(strPopupName)
{
	document.getElementById(strPopupName).style.visibility = "visible";
}	
	
function ClosePopup(strPopupName)
{
	document.getElementById(strPopupName).style.visibility = "hidden";
}
	

function CheckForInt(val, strName)
{
	if(!isNumber(val))
	{
		document.getElementById(strName).value = "";
		document.getElementById("not_numeric").style.visibility = "visible";
		return false;
	}
	else
	{
		return true;	
	}
}



function GetStyles()
{

	var strHTMLStyles;
	
		strHTMLStyles = "<style>"
		strHTMLStyles = strHTMLStyles + ".no-left-margin {margin-left:-14px;}";
		strHTMLStyles = strHTMLStyles + ".product-titles{font-family: Arial, Helvetica, sans-serif;	font-size:12px;	color:#FFFFFF;	font-weight:bold;}";
		strHTMLStyles = strHTMLStyles + "p.regular-text {margin-bottom: 12px; margin-top: 0px;}";
		strHTMLStyles = strHTMLStyles + ".regular-text {font-family: Verdana, Arial, Helvetica, sans-serif;	line-height:16px; font-size:11px; color:#000000;}";
		strHTMLStyles = strHTMLStyles + ".regular-text a:link {	font-family: Verdana, Arial, Helvetica, sans-serif;	line-height:16px; font-size:11px; color:#000000; text-decoration:underline;}";
		strHTMLStyles = strHTMLStyles + ".regular-text a:visited {font-family: Verdana, Arial, Helvetica, sans-serif; line-height:16px;	font-size:11px;	color:#000000; text-decoration:underline;}";
		strHTMLStyles = strHTMLStyles + ".regular-text a:hover {font-family: Verdana, Arial, Helvetica, sans-serif;	line-height:16px; font-size:11px; color:#C7032F; text-decoration:underline;}";
		strHTMLStyles = strHTMLStyles + ".regular-text a:active { font-family: Verdana, Arial, Helvetica, sans-serif; font-size:11px; color:#000000; text-decoration:underline; }";
		strHTMLStyles = strHTMLStyles + ".regular-text-client-list {font-family: Verdana, Arial, Helvetica, sans-serif;	font-size:11px;	color:#666666; line-height:.8em; }";
		strHTMLStyles = strHTMLStyles + ".regular-text-form { font-family: Verdana, Arial, Helvetica, sans-serif; line-height:16px;	font-size:11px;	color:#000000; letter-spacing:-1px;}";
		strHTMLStyles = strHTMLStyles + ".red-text{font-family: Verdana, Arial, Helvetica, sans-serif;font-size:10px;color:#CC0000;}";
		strHTMLStyles = strHTMLStyles + ".product-titles2{ font-family: Arial, Helvetica, sans-serif; font-size:11px; color:#FFFFFF; font-weight:bold;}";
		strHTMLStyles = strHTMLStyles + ".print-content-div {position:absolute;	left:20px; top:61px; width:490px;	height:424px; z-index:11;}";
		strHTMLStyles = strHTMLStyles + ".bottomnav-text{ font-family: Verdana, Arial, Helvetica, sans-serif; font-size:9px; color:#444141;	padding-top:0px 0px 5px 0px; text-decoration:none;}";
		strHTMLStyles = strHTMLStyles + ".bottomnav-text a:link{font-family: Verdana, Arial, Helvetica, sans-serif;	font-size:10px;	color:#444141; padding-top:0px 0px 5px 0px; text-decoration:none; }";
		strHTMLStyles = strHTMLStyles + ".bottomnav-text a:visited{font-family: Verdana, Arial, Helvetica, sans-serif; font-size:10px; color:#444141; padding-top:0px 0px 5px 0px; text-decoration:none;}";
		strHTMLStyles = strHTMLStyles + ".bottomnav-text a:hover{font-family: Verdana, Arial, Helvetica, sans-serif; font-size:10px; color:#C7032f; padding-top:0px 0px 5px 0px; text-decoration:underline;}";
		strHTMLStyles = strHTMLStyles + ".bottomnav-text a:active{font-family: Verdana, Arial, Helvetica, sans-serif; font-size:10px; color:#C7032f; padding-top:0px 0px 5px 0px; text-decoration:underline;}";
		strHTMLStyles = strHTMLStyles + ".cr-text{font-family: Verdana, Arial, Helvetica, sans-serif;font-size:9px;	color:#444141;padding-top:0px 0px 5px 0px;text-decoration:none;}";
		strHTMLStyles = strHTMLStyles + "</style>";

	return strHTMLStyles;
}
function LaunchFlash(intNum)
{
	if(intNum == 1)
	{
	if(browser == "Internet Explorer")
	{
		window.open('fireflydemo/firefly.htm','firefly','height=545,width=795,left=0,top=0,resize=no,menubar=no');
	}
	else
	{
		window.open('fireflydemo/firefly.htm','firefly','height=545,width=795,left=0,top=0,resize=no,menubar=no');
	}
}
if(intNum == 2)
	{
	if(browser == "Internet Explorer")
	{
		window.open('SYBASE/codebase_1.html','ProductDemo','height=535,width=794,left=0,top=0,resize=no,menubar=no');
	}
	else
	{
		window.open('SYBASE/codebase_1.html','ProductDemo','height=535,width=794,left=0,top=0,resize=no,menubar=no');
	}
}
if(intNum == 3)
	{
	if(browser == "Internet Explorer")
	{
		window.open('CustomPoint/mini_demo/default.asp','ProductDemo','height=700, width=1014,left=0,top=0,resize=yes,menubar=no');
	}
	else
	{
		window.open('CustomPoint/mini_demo/default.asp','ProductDemo','height=700, width=1014,left=0,top=0,resize=yes,menubar=no');
	}
}
if(intNum == 4)
	{
	if(browser == "Internet Explorer")
	{
		window.open('bbj/gold/goldsalestraining.aspx','ProductDemo','height=657, width=1014,left=0,top=0,resize=no,menubar=no');
	}
	else
	{
		window.open('bbj/gold/goldsalestraining.aspx','ProductDemo','height=657, width=1014,left=0,top=0,resize=no,menubar=no');
	}
}
if(intNum == 5)
	{
	if(browser == "Internet Explorer")
	{
		window.open('bbj/platinum/platinumsalestraining.aspx','ProductDemo','height=657, width=1014,left=0,top=0,resize=no,menubar=no');
	}
	else
	{
		window.open('bbj/platinum/platinumsalestraining.aspx','ProductDemo','height=657, width=1014,left=0,top=0,resize=no,menubar=no');
	}
}
if(intNum == 6)
	{
	if(browser == "Internet Explorer")
	{
		window.open('CUSTOMPOINT/full_demo/CustomPoint.html','ProductDemo','height=700,width=1016,left=0,top=0,resize=no,menubar=no');
	}
	else
	{
		window.open('CUSTOMPOINT/full_demo/CustomPoint.html','ProductDemo','height=700,width=1016,left=0,top=0,resize=no,menubar=no');
	}
}
if(intNum == 7)
	{
	if(browser == "Internet Explorer")
	{
		window.open('ShareStream/sharestream.htm','ProductDemo','height=700,width=1014,left=0,top=0,resize=no,menubar=no');
	}
	else
	{
		window.open('ShareStream/sharestream.htm','ProductDemo','height=700,width=1014,left=0,top=0,resize=no,menubar=no');
	}
}
}

	