﻿
var _styleNavTab = -1;
 
 function eloqua_redir_form(formTypeName) {
	 if( document.forms[0].elqFormName ){
		//document.forms[0].elqFormName.value = formTypeName;
		document.forms[0].action = 'http://now.eloqua.com/e/f.aspx';
		document.forms[0].submit();
		return false;
	 }else{
		 return true;
	 }
}
	
//===================================================================

function swapTop(o, vType){
    if (vType=="in"){
        o.originalClassName = o.className;
        o.className = "imgTopSelected";
    }else{
       o.className = o.originalClassName;
    }
   // alert(o.className);
}

function setVars(styleNavTab){
    _styleNavTab = styleNavTab;
}

function twist(oArrow, contentId){
    if (oArrow.className == "titleArrowOpen" + _styleNavTab){
        $get(contentId).className = "twistClosed";
        oArrow.className = "titleArrowClosed" + _styleNavTab
    }else{
        $get(contentId).className = "twistOpen";
        oArrow.className = "titleArrowOpen" + _styleNavTab
    }
   }

   function switchLang(lang) {
   	if (lang == "") return;
   	
   	var currentLang = Request("l");
   	if (currentLang == "") currentLang = "en";
   	if (lang == currentLang) {
   		location.href = location.href;
   		return;
   	}
   	var currentPage = location.href.substring(location.href.lastIndexOf('/') + 1);
   	if (currentPage.length > 0) {
   		var numChars = (currentPage.length - currentPage.lastIndexOf('.'));
   		numChars = currentPage.length - numChars;   		
   		currentPage = currentPage.substring(0, numChars );
   	}

   	var url = "";
   	switch (currentPage) {
   		case "": //HomePage
   			url = "About-Us";
   			break;

   		case "Contact-Us":
   			url = "Contact-Us";
   			break;

   		case "Products-and-Services":
   			url = "Products-and-Services";
   			break;

   		default:
   			url = "About-Us";
   			break;
   	}

   	url += ".aspx";
   	if (lang != "en") url += "?l=" + lang;
   	
   	location.href = url;

   }

   function Request(name) {
   	name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
   	var regexS = "[\\?&]" + name + "=([^&#]*)";
   	var regex = new RegExp(regexS);
   	var results = regex.exec(window.location.href);
   	if (results == null)
   		return "";
   	else
   		return results[1];
   }

 function loadTwisties() {
        $('.twistTitle1').click(function() {

            $(this).nextAll('span,div').eq(0).toggleClass('twistBlock');
            $(this).nextAll('span,div').eq(0).toggleClass('twistBlockOpen');
            $(this).toggleClass('twistTitleOpen1');
            $(this).toggleClass('twistTitle1');
        });

        $('.twistTitle2').click(function() {
            $(this).nextAll('span,div').eq(0).toggleClass('twistBlock');
            $(this).nextAll('span,div').eq(0).toggleClass('twistBlockOpen');
            $(this).toggleClass('twistTitleOpen2');
            $(this).toggleClass('twistTitle2');
        });

        $('.twistTitle3').click(function() {
            $(this).nextAll('span,div').eq(0).toggleClass('twistBlock');
            $(this).nextAll('span,div').eq(0).toggleClass('twistBlockOpen');
            $(this).toggleClass('twistTitleOpen3');
            $(this).toggleClass('twistTitle3');
        });

        $('.twistTitle4').click(function() {
            $(this).nextAll('span,div').eq(0).toggleClass('twistBlock');
            $(this).nextAll('span,div').eq(0).toggleClass('twistBlockOpen');
            $(this).toggleClass('twistTitleOpen4');
            $(this).toggleClass('twistTitle5');
        });

    }
