
// Hide Extra info when js enabled - Show Extra info when js disabled
fonLoad=function() {

	var extra = document.getElementById("extraInfo");
	var hidelnk  = document.getElementById("hideLink");
	var showlnk  = document.getElementById("showLink");

	extra.style.display="none";
	hidelnk.style.display="inline";
	showlnk.style.display="inline";
}


// Show Extra info
function showExtra() {

	var extra = document.getElementById("extraInfo");
	var lnk  = document.getElementById("showLink");
	
	if( extra.style.display == "block" )
	{
		extra.style.display="none"; //hides div
		lnk.innerHTML = "more&gt"; //change link text
	}
	else
	{
		extra.style.display="block";
		lnk.innerHTML = "";
	}		
	
	return false;
	
}


// Popup Windows 

/* START JS Browser detect code */
var bow="n";
var bow1="n";

bName = navigator.appName;
bVer = parseInt(navigator.appVersion);

if (bName == "Netscape" && bVer >= 3)
{
	bow = "ok";
	bow1 = "ok";
}
else if (bName == "Microsoft Internet Explorer" && bVer > 3)
{
	bow = "ok";
	bow1="ok";
}
else if (bName == "Microsoft Internet Explorer" && bVer >=2)
{
	bow = "ok";
}

var IS_AOL=0;

if (navigator.userAgent)
{
	if (navigator.userAgent.indexOf("AOL") >=0)
	{
		IS_AOL=1;
		bow1="n";
	}
}
else
{
	bow="n"
	bow1="n";
}
/* END JS Browser detect code */

/* changeImage function modified to work with the open/close images on the schedule page */
function changeImage(row,s,sched)
{
	var h = (s==1)?"r":"";
	var row_src = (parseInt(sched)>=1)?'r'+sched:row;

	if(document.images) document.images[row].src = eval(h + row_src + ".src");
}
/* Popup used in video 4:3 and popup slideshow */
function openPhotoWin(f,t){
	return openWindow(f, t, 'no', 'no', 'no', 'no', 568, 500, 'no', 'no', 'no');
}
/* Popup used in video 16:9 */
function openPhotoWin169(f,t){
	return openWindow(f, t, 'no', 'no', 'no', 'no', 568, 420, 'no', 'no', 'no');
}
/* Popup Sized Window */
function openWinSized(f,t,w,h,s,r){
	return openWindow(f, t, 'no', 'no', s, r, w, h, 'no', 'no', 'no');
}


/* general utility function that accepts parameters for url of filename (f),
target Window (t), 
menubar (m - yes/no), location (l - yes/no), 
scrollbars (s - yes/no), resizeable (r - yes/no), 
window width (w), window height (h). 
Default values are laid out in the function.

*/

function openWindow(f, t, m, l, s, r, w, h, st, tool, d)
{
	var fn_filename = "";
	var fn_target = "_blank";
	var fn_menubar = "yes";
	var fn_location = "yes";
	var fn_scrollbars = "yes";
	var fn_resizable = "yes";
	var fn_width = "600";
	var fn_height = "400";
	var fn_status = "yes";
	var fn_toolbar = "yes";
	var fn_directories = "yes";
	
	if (arguments.length > 0)
	{
		if (f != "" || f != null) fn_filename = f;
		if (t != "" || t != null) fn_target = t;
		if (m == "no") fn_menubar = m;
		if (l == "no") fn_location = l;
		if (s == "no") fn_scrollbars = s;
		if (r == "no") fn_resizable = r;
		if (w > 0) fn_width = w;
		if (h > 0) fn_height = h;
		if (st == "no") fn_status = st;
		if (tool == "no") fn_toolbar = tool;
		if (d == "no") fn_directories = d;
	}
	
	self.name="MainWin";
	
    if (bow!="ok") return (true);
	
	argumentString = 'menubar='+fn_menubar+',location='+fn_location+',scrollbars='+fn_scrollbars+',resizable='+fn_resizable+',width='+fn_width+',height='+fn_height+',status='+fn_status+',toolbar='+fn_toolbar+',directories='+fn_directories;
	
	remote =  window.open(fn_filename,fn_target,argumentString);

    if (remote == null) return true;

    if (bow1 =="ok") window.setTimeout('remote.focus()',1000);
	return (false);
}


// Flash Player 8 Detect
var url_file = '';
var MM_FlashPlayerVersion = 8;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	    for (var i = 0; i < words.length; ++i)
	    {
		if (isNaN(parseInt(words[i])))
		continue;
		var MM_PluginVersion = words[i]; 
	    }
		var MM_FlashPlayerInstalled = MM_PluginVersion >= MM_FlashPlayerVersion;
	}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<scr' + 'ipt language=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashPlayerInstalled = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_FlashPlayerVersion)))\n');
	document.write('</scr' + 'ipt\> \n');
}

// Hook for Internet Explorer. the ActiveX player raises events
// that need to be handled via vbscript. calls the eqivalent JS function
// that does the work. you need 1 of these functions per swf instance on the page.
function writeVBHandler(id)
{
	 var s = '';
	
	if (navigator.appName && 
	  navigator.appName.indexOf("Microsoft") != -1 &&
	  navigator.userAgent.indexOf("Windows") != -1 && 
	  navigator.userAgent.indexOf("Windows 3.1") == -1) 
	{	 
	  s += '<SCRIPT LANGUAGE=VBScript\> \n';
	  s += 'on error resume next \n';
	  s += 'sub '+id+'_FSCommand(ByVal command, ByVal args)\n';
	  s += ' call '+id+'_DoFSCommand(command,args)\n';
	  s += 'end sub\n';
	  s += '</SCRIPT\> \n';	  	
	}
	return s;
}

// function to validate email addresses
function checkEmail(theEmail)  {

  var foundAt = 0;
  var foundPeriod = 0;
  var checktheEmail = true;
  var errorString = ""
  for( i = 0; i < theEmail.length; i++ ) {
    if(theEmail.charAt(i) != '@') {
      foundAt++;
    } else {
      break;
    }
  }
  for( i = 0; i < theEmail.length; i++ ) {
    if(theEmail.charAt(i) != '.') {
      foundPeriod++;
    } else {
      break;
    }
  }
  if(theEmail.length == 0) {
    checktheEmail = true;
  } else if(theEmail.length == foundAt) {
    errorString += "Your email address does not contain the '@' symbol. Please make sure your email address is correct so we can contact you.";
    checktheEmail = false;
  } else if(foundAt == 0 || theEmail.charAt(foundAt - 1) == ' ') {
    errorString += "Your email address does not contain a name before the '@' symbol. Please make sure your email address is correct so we can contact you.";
    checktheEmail = false;
  } else if((theEmail.charAt(foundAt + 1) == ' ' || theEmail.charAt(foundAt + 1) == '.') || foundAt + 1 == theEmail.length) {
    errorString += "Your email address contains no details after after the '@' symbol. Please make sure your email address is correct so we can contact you.";
    checktheEmail = false;
  } else if(theEmail.length == foundPeriod) {
    errorString += "Your email address does not contain the '.' symbol. Please make sure your email address is correct so we can contact you.";
    checktheEmail = false;
  } else if(theEmail.charAt(foundPeriod + 1) == ' ' || foundPeriod + 1 == theEmail.length) {
    errorString += "Your email address contains no details after the '.' symbol. Please make sure your email address is correct so we can contact you.";
    checktheEmail = false;
  }
  if(checktheEmail == false) {
    alert(errorString);
  }
  return checktheEmail;
}



// function to clear the keyword field on search forms
function clearKeywordValue(keywordField)  {
  if (keywordField.value == "Enter a Keyword/s" || keywordField.value == "Search using keywords") {
    keywordField.value = "";
  }
}

// Country Select form navigation
function goCountry() {
  
  if (document.countryNavigation.countryURL.value != '') {
     window.location = document.countryNavigation.countryURL.value;
  } else {
    return false;
  }
	
}



// function to track SiteCatalyst Lead links
function trackSCLead(productID, leadType, leadEvent) {
  var s=s_gi(s_account);
  
  if (productID != "") {
    s.products = ";" + productID;
  }
  
  s.eVar17=leadType;
  
  if (leadEvent == 0) {
    s.events="event9";
    s.linkTrackEvents="event9"
  } else {
    s.events="event10";
    s.linkTrackEvents="event10"
  }
  
  s.linkTrackVars="eVar17,products,events"
  s.tl(this,'o','Lead');
}

function trackSCDownload(downloadName) {
  var s=s_gi(s_account);
  s.linkTrackVars='eVar18,events';
  s.linkTrackEvents='event11';
  s.events='event11';
  s.eVar18=downloadName;
  s.tl(this,'d',downloadName);
}

function trackSCEvent(eventID) {
  var s=s_gi(s_account);
  s.events=eventID
  s.linkTrackVars="events"
  s.linkTrackEvents=eventID
  s.tl(true,'o','Login');
}

function trackSCPartnerRefer(partnerName) {
  var s=s_gi(s_account);
  s.events="event13"
  s.eVar20=partnerName;
  s.linkTrackVars="eVar20,events"
  s.linkTrackEvents="event13"
  s.tl(true,'o','Partner Referral');
}