function do_tbd(form) {
	goURL=form.tbd.options[form.tbd.selectedIndex].value;
	if (goURL!="none"){ window.open (goURL,'_self'); }
}

function genRMIlink(){
	document.location ="/cgi-shell/products/product_info.pl?product=" + document.title;
}

function getSeminars(){
	if (document.zipped){
		zip = document.zipped.Zip.value;
	}
	else{
		zip = document.getElementById("zip").value;
	}
	url = "/cgi-shell/db/events/geteventszip.pl?Zip=" + zip;
	//alert(url);

	//Check to see if zip is at least 5 characters in order to stop empty values from being sumbitted.
	if (zip.length < 5){
		return true;
	} else {
		window.open(url,"fred","height=500,width=600,scrollbars=1,directories=0,menubar=0,location=0,status=0,resizable=1");
	}
	return false;
}

function redirectTo(PassedURL){
	window.location = PassedURL;
}

////begin cookie scripts
var elementArray = new Array();

if (location.hostname.indexOf("fr") > -1){
	var cookieFields 	= new Array('Nom','Fonction','Telephone','Adresse','Ville','Prenom','Societe','AdresseEmail','CodePostal');
	var ddlist			= new Array('Civilite');
}
else if(location.hostname.indexOf("uk") > -1){
	var cookieFields 	= new Array('First_name','Last_name','Job_title','Company','Phone','Email','Address1','Address2','Address3','City','Postcode');
	var ddlist			= new Array('Title');
}
else if(location.hostname.indexOf("es") > -1){
	var cookieFields 	= new Array('Nombre','Apellido','Cargo','Empresa','Telefono','EmailAddress','Direccion','CodigoPostal','Ciudad');
	var ddlist			= new Array('Cortesia');
}
else if(location.hostname.indexOf("mx") > -1){
	var cookieFields 	= new Array('Nombre','Apellido','Cargo','Empresa','Telefono','EmailAddress','Direccion','CodigoPostal','Ciudad');
	var ddlist			= new Array('Cortesia');
}
else if(location.hostname.indexOf(".de") > -1  || location.hostname.indexOf("dedevh") > -1){
	var cookieFields 	= new Array('Vorname','Nachname','Firma','Adresse','Postleitzahl','Stadt','Emailadresse','Telefonnummer','Funktion', 'Doc2');
	var ddlist			= new Array('Anrede');
}
else if(location.hostname.indexOf("nl") > -1){
	var cookieFields 	= new Array('Vraag_details', 'Achternaam','Voornaam','Functie','Bedrijf','Telefoon','Adres','Plaats','Post_code','Email');
	var ddlist			= new Array('Vraag_onderwerp','Titel');
}
else if(location.hostname.indexOf(".be") > -1 || location.hostname.indexOf("beldevh") > -1){
	var cookieFields 	= new Array('First_name','Last_name','Job_title','Company','Phone','Email','Address1','Postcode','City');
	var ddlist			= new Array('Title');
}
else if(location.hostname.indexOf("ch") > -1){
	var cookieFields 	= new Array('Vorname','Nachname','Firma','Adresse','Postleitzahl','Stadt','Emailadresse','Telefonnummer','Funktion');
	var ddlist			= new Array('Anrede');
}
else if(location.hostname.indexOf("pt") > -1){
	var cookieFields 	= new Array('Nome','Apelido','Funcao','Empresa','Telefone','Email','Morada','Codigo_postal','Cidade', 'Pais');
	var ddlist			= new Array('Cortesia');
}
else{
	var cookieFields 	= new Array('First_Name' , 'Last_Name' ,'Title' ,'Company' ,'Address1' ,'Address2', 'City', 'Zip', 'Phone', 'Email', 'emailMe');
	var ddlist			= new Array('Title_category', 'State', 'Country');
}
// drop down items must be handled

var nocoV;
nocoV = getCookie('noco');
//alert('this is noco val' + nocoV);


function setup(name){

var value = new Array;
// go through the cookieFields list
// and see if any of them have vals now
// pop them into a new value array
var tempi;
for (i=0; i< cookieFields.length; i++){
	current_item = 'document.getElementById(\'form\').' + cookieFields[i] + '.value';
	if  (eval(current_item)) {
		 	var ent_case = cookieFields[i] + "=" + eval(current_item) + "&";
			value.push(ent_case);
	}
}

// go through drop down list
if(nocoV!=1){
	var tempi = cookieFields.length;
	for (t=0; t< ddlist.length; t++){
		current_item = 'document.getElementById(\'form\').' + ddlist[t] + '.selectedIndex';
		if  (eval('document.getElementById(\'form\').' + ddlist[t])) {
			value[tempi] = ddlist[t] + "=" + eval(current_item) + "&";
			tempi++;
		}
	}
}//if

// now we know which have values
// lets join this array to make
// one long string
var value = value.join("");
	// debug
	//alert('this is the value string' + value);

  var expdate = new Date ();
  //var domain = ".informationbuilders.com";
   var path = "/";
  expdate.setTime (expdate.getTime() + (365 * 24 * 60 * 60 * 1000));
  //setCookie(name, value, expdate, domain,path);
  setCookie(name, value, expdate,path);

return 'true';
//  return false;
}//setup


function setCookie(name, value, expires, path, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
   //   ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
	 	//alert('setCookie' + curCookie);
  document.cookie = curCookie;
  return true;
}


function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

function processCookie(cookieName) {

  var cookieString;
  cookieString = getCookie(cookieName);
  //alert(cookieString);
  if (cookieString != null) {
	//parseCookieString(cookieString);
	getValues(cookieString);
  }
}

function parseCookieString(cookieString) {
  var i = 0;
  var begin = 0;
  var end = 0;
  while (i<12) {
  	end = cookieString.indexOf("^=", begin);
  	elementArray[i] = cookieString.substring(begin, end);
	begin = end + 2;
	end = cookieString.indexOf("^=", begin);
  	eval("document.getElementById(\'form\')." + elementArray[i]).value = cookieString.substring(begin, end);
	begin = end + 2;
	i++;
  }
}

function getValues(cookieString) {
if(nocoV!=1){
	for (i=0; i<cookieFields.length; i++){
		var typeOF = "text";
		if (eval('document.getElementById(\'form\').'+cookieFields[i])) {
			var checkGetVal = getValue(cookieString, cookieFields[i], eval('document.getElementById(\'form\').'+cookieFields[i]), typeOF);
				if (!checkGetVal){
					for (t=0; t< ddlist.length; t++){
						if (eval('document.getElementById(\'form\').'+ddlist[t])){
							current_item = 'document.getElementById(\'form\').' + ddlist[t] + '.selectedIndex';
							getValue(cookieString, ddlist[t], eval('document.getElementById(\'form\').'+ddlist[t]), 'select');
						}
					}
				}
		}
	}

	for (t=0; t< ddlist.length; t++){
		if (eval('document.getElementById(\'form\').'+ddlist[t])){
			current_item = 'document.getElementById(\'form\').' + ddlist[t] + '.selectedIndex';
			getValue(cookieString, ddlist[t], eval('document.getElementById(\'form\').'+ddlist[t]), 'select');
		}
	}
}//openif
 }

 function getValue(cookieString,elementName,object,elementType) {
 // gets value of elementName from string and populates object of elementType
	var elementName = new String(elementName);
     var startPos = cookieString.indexOf(elementName + "=")
     if (startPos > -1) {
         startPos = startPos + elementName.length + 1;
         var endPos = cookieString.indexOf("&",startPos);
         if (endPos == -1) endPos = cookieString.length;

         var elementValue = unescape(cookieString.substring(startPos,endPos));
         if(elementValue == "USA"){elementValue = "0"};
         if (elementType == "text")     object.value = elementValue;
         if (elementType == "password") object.value = elementValue;
         if (elementType == "select")   object.selectedIndex = eval(elementValue)
         if (elementType == "checkbox") object.checked = onCheck(elementValue);
         if (elementType == "radio")    object[elementValue].checked = true;
     }
return elementValue;
 }
//////end cookie scripts


function openNewWindow(linkto,name,w,h,t,l,m,r,st,sc)
{
	if ((w == null) || (w == ""))
	{
	w="640";
	}
	if ((h == null) || (h == ""))//height
	{
	h="320";
	}
	if ((t == null) || (t == ""))//toolbar
	{t = "1";
	}
	if ((l == null) || (l == ""))//locationbar
	{
	l = "1";
	}

	if ((m == null) || (m == ""))//menubar
	{
	m = "1";
	}

	if ((r == null) || (r == ""))//resizr
	{
	r = "1";
	}
	if ((st == null) || (st == ""))//scrollbars and status are called as scrollbars or status not true or false
	{
	st = "status";
	}
	if ((sc == null) || (sc == ""))//scrollbars and status are called as scrollbars or status not true or false
	{
	sc = "scrollbars";
	}

	newWindow=window.open(linkto,name,"toolbar="+t+",directories=0,menubar="+m+",location="+l+",width="+w+",height="+h+",resizable="+r +","+ st +"," + sc);
        if (navigator.appName != "Microsoft Internet Explorer")
        {
                newWindow.focus();
        }
}

function windowsizeObject(){
	this.winW = 0;
	this.winH = 0;

	if (parseInt(navigator.appVersion)>3) {
	 if (navigator.appName=="Netscape") {
	  this.winW = window.innerWidth;
	  this.winH = window.innerHeight;

	 }
	 if (navigator.appName.indexOf("Microsoft")!=-1) {
	  this.winW = document.body.offsetWidth;
	  this.winH = document.body.offsetHeight;

	 }
	}
}

function popUp(){return;}
function popDown(){return;}
function roll_on(a){ a=1;}
function roll_off(b){ b=2;}

function openWin(url) {
 myWin= open(url,"","toolbar=NO,location=NO,resizable=YES,width=500,height=300,scrollbars=YES,x=150,y=75");
}


   if(window.event + "" == "undefined") event = null;
   function HM_f_PopUp(){return false};
   function HM_f_PopDown(){return false};

function summit_popup(){
	if (!getCookie('ExCookie2007') && !getCookie('todaycookie')){
		window.open('/events/summit/pop_up4.html','','width=512,height=251');
		//window.open('/events/summit/pop_up4.html', 'Summit 2007', 'width=512,height=251,menubar=no,location=n');
	}
}

function positionTheNumber(days){
	if (days < 10){
		document.getElementById('daydiv').style.top='365px';
		document.getElementById('daydiv').style.left='712px';
	}
	document.getElementById('daydiv').innerHTML= days;
}

function positionTheNumbera(days){
	if (days < 10){
		document.getElementById('daydiv').style.top='314px';
		document.getElementById('daydiv').style.left='830px';
	}
	document.getElementById('daydiv').innerHTML= days;
}
function dateCountDown(EventDate){
				var today = new Date();
				var summitdate = new Date(EventDate);
				var diff = summitdate.getTime() - today.getTime();
				var days = Math.floor(diff / (1000 * 60 * 60 * 24)) + 1;
				return days;
			}


function bV(){
if(browser.isIE){
	if(browser.versionMinor > 5.4){
		window.location ="http://www.informationbuilders.com/cgi-shell/test_drive/testdrive_form.pl?Demo_Code=DEMOcentcorp";
		return false;
	} else {
		alert('This demonstration requires Internet Explorer Version 5.5 or higher. Please upgrade your browser or select another WebFOCUS demonstration.');
		return false;
	}
} else {
	if(browser.isGecko){
			if(browser.versionMinor >= 1.5){
					window.location ="http://www.informationbuilders.com/cgi-shell/test_drive/testdrive_form.pl?Demo_Code=DEMOcentcorp";
			} else {
					alert('This demonstration requires Internet Explorer Version 5.5 or higher. Please upgrade your browser or select another WebFOCUS demonstration.');
			return false;
			}
	} else {
		alert('This demonstration requires Internet Explorer Version 5.5 or higher. Please upgrade your browser or select another WebFOCUS demonstration.');
		return false;
	}
	return false;
}//if
}//bV

function closeWindow() {
   window.open('','_parent','');
   window.close();
}


function externalLinks() {
 if (!document.getElementsByTagName) return;
 var anchors = document.getElementsByTagName("a");
 for (var i=0; i<anchors.length; i++) {
   var anchor = anchors[i];
   if (anchor.getAttribute("href") &&
       anchor.getAttribute("rel") == "external")
     anchor.target = "_blank";
 }
 var forms = document.getElementsByTagName("form");
 for (var i=0; i<forms.length; i++) {
   var f = forms[i];
   if (f.getAttribute("action") &&
       f.getAttribute("rel") == "external")
     f.target = "_blank";
 }
}
window.onload = externalLinks;
//$(document).ready(function(){
//	externalLinks;();
//
//});

function mainmenu(){
$(" #nav ul ").css({display: "none"}); // Opera Fix
$(" #nav li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(400);
		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
		});

$(" #utn ul ").css({display: "none"}); // Opera Fix
$(" #utn li").hover(function(){
		$(this).find('ul:first').css({visibility: "visible",display: "none"}).show(400);
		},function(){
		$(this).find('ul:first').css({visibility: "hidden"});
		});
$(" #nav li ul>li:odd").css({'background-color':'#f4f4f4'});
$(" #nav li ul>li:even").css({'background-color':'#eaeaea'});
$(" #nav li ul li ul li:odd").css({'background-color':'#f4f4f4'});
$(" #nav li ul li ul li:even").css({'background-color':'#eaeaea'});
$(" #utn li ul li:odd").css({'background-color':'#f4f4f4'});
$(" #utn li ul li:even").css({'background-color':'#eaeaea'});
}
