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 goCountry() {
	var theVar = document.getElementById("country_select");
	var theVarVal  = theVar[theVar.selectedIndex].value;
	if(theVarVal == "French")
		redirectLoc = "http://www.spotfire.com/fr/";
	else if(theVarVal == "German")
		redirectLoc = "http://www.spotfire.com/de/";
	else if(theVarVal == "Japanese")
		redirectLoc = "http://jp.spotfire.com";
	else if(theVarVal == "English")
		redirectLoc = "http://www.spotfire.com";
		document.location = redirectLoc;
}

function goEvent() {
	var theVar = document.getElementById("searchEvents");
	var theVarVal  = theVar[theVar.selectedIndex].value;
	if(theVarVal == "UC")
		redirectLoc = "/events/userconference2006/";
	else if(theVarVal == "webcasts")
		redirectLoc = "/events/webcasts/";
	else if(theVarVal == "speak")
		redirectLoc = "/events/events_by_industry.cfm";
	
	document.location = redirectLoc;
}

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 flipNav(n,whichWay) {
	if (document.getElementById) {
          	var divideIMG = document.getElementById("navlt"+n);
			var divideIMG2 = document.getElementById("navrt"+n);
			if(whichWay == "on") {
				divideIMG.className='left_divide_on';
				divideIMG2.className='right_divide_on';
			}
			else {
				divideIMG.className='left_divide';
				divideIMG2.className='right_divide';
			}
	}
}

function pushNav(n) {
	if (document.getElementById) {
          	var navEle = document.getElementById("secondary_nav_elements");
			navEle.style.marginLeft = n + "px";
	}
}

function pushTIBCONav(n) {
	if (document.getElementById) {
          	var navEle = document.getElementById("navElementsSecondary");
			navEle.style.marginLeft = n + "px";
	}
}

function swapBanner(banner) {
	if (document.getElementById) {
          var bannerIMG = document.getElementById("banner");
		  bannerIMG.style.backgroundImage = "url(http://www.spotfire.com/images_dxp/banners/" + banner + ".jpg)";
	}
}

function flipNav3(n,whichWay) {
	if (document.getElementById) {
          	var navIMG = document.getElementById("tert_nav"+n);
			if(whichWay == "on") {
				navIMG.className='tertiary_nav_blip_on';
			}
			else {
				navIMG.className='tertiary_nav_blip';
			}
	}
}

function flipEle(theElement,whichWay,switchTo,switchBack) {
	if (document.getElementById) {
          	var navIMG = document.getElementById(theElement);
			if(whichWay == "on") {
				navIMG.className=switchTo;
			}
			else {
				navIMG.className=switchBack;
			}
	}
}

function flipTool(n,whichWay) {
	if (document.getElementById) {
          	var navIMG = document.getElementById(n);
			if(whichWay == "on") { 
				if(n=="topnav_buy")
					navIMG.style.backgroundImage = 'url(http://www.spotfire.com/images_dxp/nav/how_to_buy_on.jpg)';
				else if(n=="topnav_blog")
					navIMG.style.backgroundImage = 'url(http://www.spotfire.com/images_dxp/nav/spotfire_blogs_on.jpg)';
				else if(n=="topnav_contact")
					navIMG.style.backgroundImage = 'url(http://www.spotfire.com/images_dxp/nav/contact_on.jpg)';
			}
			else {
				if(n=="topnav_buy")
					navIMG.style.backgroundImage = 'url(http://www.spotfire.com/images_dxp/nav/how_to_buy.jpg)';
				else if(n=="topnav_blog")
					navIMG.style.backgroundImage = 'url(http://www.spotfire.com/images_dxp/nav/spotfire_blogs.jpg)';
				else if(n=="topnav_contact")
					navIMG.style.backgroundImage = 'url(http://www.spotfire.com/images_dxp/nav/contact.jpg)';
			}
	}
}

function flipDS(whichWay) {
	if (document.getElementById) {
          	var navIMG = document.getElementById(n);
			if(whichWay == "on") 
				navIMG.style.backgroundImage = 'url(/images_dxp/resources/dxp_player_on.jpg)';
			else 
				navIMG.style.backgroundImage = 'url(/images_dxp/resources/dxp_player.jpg)';
	}
}


function PrintThisPage(theID) { 
   var sOption="toolbar=yes,location=no,directories=yes,menubar=yes,"; 
       sOption+="scrollbars=yes,width=750,height=600,left=100,top=25"; 
	
   var sWinHTML = document.getElementById(theID).innerHTML; 
	
   var winprint=window.open("","",sOption); 
       winprint.document.open();
	   winprint.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
	   winprint.document.write('<html xmlns="http://www.w3.org/1999/xhtml">');
       winprint.document.write('<head><link rel="stylesheet" type="text/css" href="/style/print.css" media="print">');
	   winprint.document.write('<link rel="stylesheet" type="text/css" href="/style/common.css" media="screen">');
	   winprint.document.write('<title>Spotfire, Inc.</title></head><body id="bodyContainer">'); 
	  // winprint.document.write('<div id=logo></div>'); 
       winprint.document.write(sWinHTML);
	             
       winprint.document.write('</body></html>');
       winprint.document.close(); 
       winprint.focus(); 
	   winprint.print();
	   winprint.close();
}

// for customer assets
function popLogin(pdf,dir,name) {
	pdf = escape(pdf);
	dir = escape(dir);
	name = escape(name);
	
	theURL = "/download.cfm?theFile=/customer_presentations/uc2004/" + pdf + "&pid=1&type=pres";

	window.open(theURL,'popup','top=200,left=200,width=600,height=600,scrollbars=1,resizable=1,status=no,');
}

function toggleBox(szDivID, iState) // 1 visible, 0 hidden
{
	hideHomeNav()
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
	
	topNavEle = "topNav" + szDivID;
	if(szDivID == "homePartners") {
		obj.style.left = "140px";
		document.images[topNavEle].src = "/images_dxp/nav/partners_on.jpg";
	}
	else if(szDivID == "homeSolutions") {
		obj.style.left = "150px";
		document.images[topNavEle].src = "/images_dxp/nav/solutions_on.jpg";
	}
	else if(szDivID == "homeProducts") {
		obj.style.left = "170px";
		document.images[topNavEle].src = "/images_dxp/nav/products_on.jpg";
	}
	else if(szDivID == "homeCustomers") {
		obj.style.left = "290px";
		document.images[topNavEle].src = "/images_dxp/nav/customers_on.jpg";
	}
	else if(szDivID == "homeNews") {
		obj.style.left = "490px";
		document.images[topNavEle].src = "/images_dxp/nav/news_on.jpg";
	}
	else if(szDivID == "homeSupport") {
		obj.style.left = "395px";
		document.images[topNavEle].src = "/images_dxp/nav/customer_support_on.jpg";
	}
}

function toggleBoxTIBCO(szDivID, iState) // 1 visible, 0 hidden
{
	hideHomeNav()
    if(document.layers)	   //NN4+
    {
       document.layers[szDivID].visibility = iState ? "show" : "hide";
    }
    else if(document.getElementById)	  //gecko(NN6) + IE 5+
    {
        var obj = document.getElementById(szDivID);
        obj.style.visibility = iState ? "visible" : "hidden";
    }
    else if(document.all)	// IE 4
    {
        document.all[szDivID].style.visibility = iState ? "visible" : "hidden";
    }
	
	topNavEle = "topNav" + szDivID;
	if(szDivID == "homePartners") {
		obj.style.left = "140px";
	}
	else if(szDivID == "homeSolutions") {
		obj.style.left = "150px";
	}
	else if(szDivID == "homeCommunities") {
		obj.style.left = "575px";
	}
	else if(szDivID == "homeProducts") {
		obj.style.left = "170px";
	}
	else if(szDivID == "homeCustomers") {
		obj.style.left = "290px";
	}
	else if(szDivID == "homeNews") {
		obj.style.left = "490px";
	}
	else if(szDivID == "homeSupport") {
		obj.style.left = "395px";
	}
}

function hideHomeNav() {
	//document.images["topNavhomePartners"].src = "/images_dxp/nav/partners.jpg";
	//document.images["topNavhomeSolutions"].src = "/images_dxp/nav/solutions.jpg";
	//document.images["topNavhomeProducts"].src = "/images_dxp/nav/products.jpg";
	//document.images["topNavhomePartners"].src = "/images_dxp/nav/partners.jpg";
	//document.images["topNavhomeCustomers"].src = "/images_dxp/nav/customers.jpg";
	//document.images["topNavhomeNews"].src = "/images_dxp/nav/news.jpg";
	//document.images["topNavhomeSupport"].src = "/images_dxp/nav/customer_support.jpg";
	
	var homePartners = document.getElementById("homePartners");
	var homeSolutions = document.getElementById("homeSolutions");
	var homeProducts = document.getElementById("homeProducts");
	var homeCustomers = document.getElementById("homeCustomers");
	var homeNews = document.getElementById("homeNews");
	var homeSupport = document.getElementById("homeSupport");
	var homeCommunities = document.getElementById("homeCommunities");
	
	homePartners.style.visibility = "hidden";
	homeSolutions.style.visibility = "hidden";
	homeProducts.style.visibility = "hidden";
	homeCustomers.style.visibility = "hidden";
	homeNews.style.visibility = "hidden";
	homeSupport.style.visibility = "hidden";
	homeCommunities.style.visibility = "hidden";
}

var di	= document.images;
function mOver(imgName,imgTo,textChange)
{
	di[imgName].src = imgTo;
	
	if (document.getElementById) {
		tDivID = textChange;
        var navIMG = document.getElementById(tDivID);
		if(navIMG.style.textDecorationUnderline)
			navIMG.style.textDecorationUnderline = false;
		else
			navIMG.style.textDecorationUnderline = true;
	}
}

// add to favorites
function CreateBookmarkLink() {
 title = "TIBCO Spotfire"; 
 

 url = location.href;

	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }

 }

function printpage() {
	window.print();  
}

// this function sets equal lengths for left and right columns.  It expects the two elements to exist.
function fixColumns() {
	if (window.location.toString().indexOf("support.spotfire.com") == -1) { // main site
		if (window.location.toString().indexOf("search.aspx") === -1) {
			jQuery(".layoutColumn").equalHeights();
		}
	}
	else { // support site
		if (document.getElementById("secondaryNav")){
			var maxHeight = 0;
	        var lh=document.getElementById("secondaryNav").offsetHeight;
			if (document.getElementById("contentContainer"))
				var containerName = "contentContainer";
			else
				var containerName = "contentContainer2";
				
			var rh=document.getElementById(containerName).offsetHeight;
			var nh = Math.max(rh, lh) + 30;

			document.getElementById("secondaryNav").style.height=nh+"px";
			document.getElementById(containerName).style.height=nh+"px";
		}
	}
}

function confirmFr(theURL) {
  if (confirm("La page souhaitée est uniquement disponible en anglais.\n\nVous êtes sur le point de quitter le site en francais.\n\n Si vous ne souhaitez pas basculer sur le site en anglais.")) {
    document.location = theURL;
  }
}

function confirmDe(theURL) {
    if (confirm("Warnung!\n\nDie gewünschte Seite ist nur auf Englisch zur Verfügung.\n\nSie sind dabei die Seite in english zu verlassen.  Falls Sie nicht wünschen sollten, die englische Seite einzutreten, bitte")) {
        document.location = theURL;
    }
}

function confirmJp(theURL) {
    if (confirm("Warnung!\n\nDie gewünschte Seite ist nur auf Englisch zur Verfügung.\n\nSie sind dabei die Seite in english zu verlassen.  Falls Sie nicht wünschen sollten, die englische Seite einzutreten, bitte")) {
        document.location = theURL;
    }
}

function worldwide() {
	var displayMode = document.getElementById("navUtilityWorldwideVals").style.display;
	if(displayMode == "inline")
		document.getElementById("navUtilityWorldwideVals").style.display = "none";
	else
		document.getElementById("navUtilityWorldwideVals").style.display = "inline";
}

/**
 * DHTML email validation script. Courtesy of SmartWebby.com (http://www.smartwebby.com/dhtml/)
 */

function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   alert("Invalid E-mail")
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   alert("Invalid E-mail ID")
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    alert("Invalid E-mail ID")
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    alert("Invalid E-mail ID")
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    alert("Invalid E-mail ID")
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    alert("Invalid E-mail ID")
		    return false
		 }

 		 return true					
	}

function ValidateForm(){
	var emailID=document.theForm.vtrenzemail
	
	if ((emailID.value==null)||(emailID.value=="")){
		alert("Please Enter your Email")
		emailID.focus()
		return false
	}
	if (echeck(emailID.value)==false){
		emailID.value=""
		emailID.focus()
		return false
	}
	return true
 }