



// Navigation Preloading and Image-Swap functions
function preloadImages(imgArray)
{
	var imgPath = "images/";

	for (n=0; n < imgArray.length; n++)
	{
		eval("var img" + n + " = new Image();");
		eval("img" + n + ".src = '" + imgPath + imgArray[n] + "';");
	}
}


var primaryImgRolloverArray = new Array(
	// navigation
	"common/header/nav_home2_over.gif",
	//"common/header/nav_home_over.gif",
	"common/header/nav_what_over.gif",
	"common/header/nav_why_over.gif",
	"common/header/nav_how_over.gif",
	"common/header/nav_features_over.gif",
	"common/header/nav_packages_over.gif",
	//"common/header/nav_freetrial_over.gif",
	//"common/header/nav_pricing_over.gif",
	"common/header/nav_partners_over.gif",
	"common/header/nav_support_over.gif",

	// tell a friend
	"common/footer/btn_tellafriend_over.gif",

	// home promo buttons
	"home/freetrial_btn_over.gif",
	//"home/buy_btn_over.gif",
	"home/try_btn_over.gif",
	"home/demo_btn_over.gif",
	"common/btn_LearnMore_over.gif",
	"common/btn_SeeMoreExamples_over.gif"
);


var secondaryImgRolloverArray = new Array(
	"common/btn_HowDoesItWork_over.gif",
	"common/btn_ReadEntireCaseStudy_over.gif",
	"common/btn_ReadMore_over.gif",
	"common/btn_SignUpNow_over.gif",
	"common/btn_SignUpToday_over.gif",
	"common/btn_TryNow_over.gif",
	"common/btn_ViewDemoMovie_over.gif",
	"common/btn_ViewPricing_over.gif",

	"special/detailedpricing_freetrial_over.gif"
);

function submitForm()
{
	document.form1.submit();
}


function swapSrc(who, what) { who.src = what; }
function swapBg(who, what)	{ who.style.backgroundImage = "url(" + what + ")"; }


// navigation highlight
function hiliteNav(item) 
{
	var btn = document.getElementById(item);
	
	if (btn)
	{
		btn.src = btn.src.substring(0, btn.src.length - 4) + "_over.gif";
		btn.onmouseover = new Function();
		btn.onmouseout  = new Function();
	}
}


// warn users about small resolution
var screenW = screen.width;
var screenH	= screen.height;

// universal JS centered window-opening function 
function windowOpen(url, winName, width, height, peripherals)
{
	// adjust for window sizes that are larger than the user's screen:	
	if (width > (screenW - 50)) 	width = screenW - 50;
	if (height > (screenH - 50))	height = screenH - 50;

	// determine x,y for centered window
	var winLeft	= ((screenW - width) / 2) - 16;
	var winTop	= (screenH - height) / 2;

	// open it (peripherals may include resizable, scrollbars, menubar, toolbar, etc)
	var win = window.open(url, winName, "width=" + width + ",height=" + height + ",left=" + winLeft + ",top=" + winTop + (peripherals ? "," + peripherals : ""));
	win.focus();
	
	return false;
}




// String Truncation Code

function truncate(text,chars) {

	if (text.length <= chars) {
		
		document.write(text); 
	
	} else {
	
		var newText = text.substring(0,chars);
		
		var breakSpot = /[ \.\?\!\;\,\:]/;
		
		// make sure there is at least one breakspot, if not return as is plus elipses
		if (newText.match(breakSpot) == null) {
			document.write(newText += "&#0133;");
			return;
		}

		// find the first break character from the end
		while (newText.charAt(newText.length-1).match(breakSpot) == null) {
			newText = newText.substring(0,newText.length-1);
		}
		
		// find the first real character from the new end
		while (newText.charAt(newText.length-1).match(breakSpot) != null) {
			newText = newText.substring(0,newText.length-1);
		}

		document.write(newText += "&#0133;");
		
	}
}



function trimWhitespace(s)
{
	while (s.charAt(0) == " ")
	{
		s = s.substring(1);
	}
	
	while (s.charAt(s.length - 1) == " ")
	{
		s = s.substring(0, s.length - 1);
	}
	
	return s;
}


function trimFormWhitespace(thisForm)
{
	for (f=0; f < thisForm.elements.length; f++)
	{
		if (thisForm.elements[f].type == "text" || thisForm.elements[f].type == "textarea")
		{
			thisForm.elements[f].value = trimWhitespace(thisForm.elements[f].value);
		}
	}
}


function getFlashMovieObject(movieName)
{
	if (window.document[movieName]) 
	{
		return window.document[movieName];
	}

	if (navigator.appName.indexOf("Microsoft Internet")==-1)
	{
		if (document.embeds && document.embeds[movieName])
		{
			return document.embeds[movieName]; 
		}
	}
	else 
	{
		return document.getElementById(movieName);
	}
}


function VHSS_DoFSCommand() {}


function sendLinkEvent(accnt,lnkname,type){
		
	if (typeof(s_account)=="undefined" || typeof(s_gs)=="undefined") return;
	accnt=accnt?accnt:s_account;	
	s_linkType=type?type:"o";
	s_lnk=true;
	s_linkName=lnkname?lnkname:s_linkName?s_linkName:"Flash Link Event";
	void(s_gs(accnt))
}

/* lmh 
setUpTabs  = function(){
	// find the tab number in the url, and open page to that tab
	if (location.href.indexOf("#")!=-1) {
		var start = (location.href.indexOf("#"));
		var tabNum =	location.href.substring(start+1,start + 2);
		if (tabNum == ''){
			tabNum = 0;	
		}
							   
	} else {
		tabNum = 0;		
	}
	swaptabs(tabNum);	
}
swaptabs = function(num){
	var tabs = document.getElementById("tabs");
	var x = tabs.getElementsByTagName("LI");
	//alert(obj.name + " in swaptabs:"  +   x.length + " thats how many ");
	var y = document.getElementsByClassName("mainContent");
			//alert( " in swaptabs:"  +  num );
	for (var i=0; i<x.length; i++) {
		 if (i != num){
			x[i].className="notselected";
			y[i].id ="notselected";
		 } else {
			 x[i].className="selected";
			 y[i].id ="selected";
		 }
	}
}
document.getElementsByClassName = function(clsName){
    var retVal = new Array();
    var elements = document.getElementsByTagName("*");
    for(var i = 0;i < elements.length;i++){
        if(elements[i].className.indexOf(" ") >= 0){
            var classes = elements[i].className.split(" ");
            for(var j = 0;j < classes.length;j++){
                if(classes[j] == clsName)
                    retVal.push(elements[i]);
            }
        }
        else if(elements[i].className == clsName)
            retVal.push(elements[i]);
    }
    return retVal;
}
function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
    window.onload = func;
  } else {
    window.onload = function() {
      if (oldonload) {
        oldonload();
      }
      func();
    }
  }
}

	addLoadEvent(setUpTabs);
	
	
 end lmh */

function directParentFromPopup(sUrl) 
{
	if (window.opener) 
		window.opener.location.href = sUrl;
	else
		window.open(sUrl, 'noParent');
	
	window.setTimeout('self.close()', 100);
}






