﻿var lastNav="";
nav2c='gen';
nav='off';
firstclick=-1;
go_direct_level_1='off';
nav2startdata='';
nav2c_height=0;
var agent = navigator.userAgent.toLowerCase();
msie_windows=-1;
msie= navigator.userAgent.search(/MSIE.+/);
windows= navigator.userAgent.search(/Windows.+/);
 if(msie != -1 && windows != -1) {
  msie_windows=1;
}
function closeOldNav(newId){
    if (lastNav) {
        document.getElementById(lastNav).style.visibility='hidden'
    }    
    lastNav=newId;
} 
function activate_iframe(whatid,whatheight) {
 if (msie_windows == 1 && wherex=="header") {
  document.getElementById('iframe_'+whatid).style.height=whatheight;
  document.getElementById('iframe_'+whatid).className='iframe_'+whatid;
 }
}
function seton(nav_id) {
 nav=nav_id;
}
function setoff(nav_id) {
 nav='off';
 window.setTimeout("clicknavx('"+nav_id+"')",5);
}
function clicknavx(nav_id) {
 if (nav=='off') {
  if (nav_id=='nav1c') {
   document.getElementById('nav1a').style.borderBottom='1px solid #000000';
  }
  else if (nav_id=='navworldc') {
   document.getElementById('navworlda').style.borderBottom='1px solid #000000';
  }
  else {
   document.getElementById('nav2a').style.borderBottom='1px solid #000000';
  }
//  if (agent.indexOf("msie") != -1 && wherex=="header" && nav_id=='nav1c') {
//   document.getElementById('iframe_'+nav_id).className='iframe_default';
  if (msie_windows == 1 && wherex=="header") {
   document.getElementById('iframe_nav1c').className='iframe_default';
   document.getElementById('iframe_nav2c').className='iframe_default';
   document.getElementById('iframe_nav4c').className='iframe_default';
   document.getElementById('iframe_nav5c').className='iframe_default';
  }
  document.getElementById(nav_id).style.visibility='hidden'
 }
}
function clicknav(thisid,nav_id) {
 if (document.getElementById(nav_id).style.visibility=='hidden') {
  thisid.style.borderBottom='none';
  document.getElementById(nav_id).style.visibility='visible';
 } else {
   thisid.style.borderBottom='1px solid #6e80b8';
//  if (agent.indexOf("msie") != -1 && wherex=="header" && nav_id=='nav1c') {
//   document.getElementById('iframe_'+nav_id).className='iframe_default';
  if (msie_windows == 1 && wherex=="header") {
   document.getElementById('iframe_nav1c').className='iframe_default';
   document.getElementById('iframe_nav2c').className='iframe_default';
   document.getElementById('iframe_nav4c').className='iframe_default';
   document.getElementById('iframe_nav5c').className='iframe_default';
  }
  document.getElementById(nav_id).style.visibility='hidden';
 }
 if (nav_id!='nav1c') {
//  go_direct_level_1='off';
 }
}
function opendefault(firstac, firstguid, firstcolor) {
// do nothing by order of t.green
//            document.getElementById('nav1a').firstChild.data=document.getElementById('nav_ac'+firstac).firstChild.data;
//        if (wherex=='startpage') {
//         document.getElementById('nav2a').style.backgroundColor=firstcolor;
//         document.getElementById('nav1a').style.backgroundColor=firstcolor;
//        } else {
//         document.getElementById('nav2a').style.color=firstcolor;
//         document.getElementById('nav1a').style.color=firstcolor;
//        }
//            document.getElementById('nav2c_'+firstguid).style.visibility='visible';
}
function changetox(thisheadline,thisarea,thisnav,directlink,countriesid) {
//  if (agent.indexOf("msie") != -1 && wherex=="header" && nav_id=='nav1c') {
//   document.getElementById('iframe_'+nav_id).className='iframe_default';
  if (msie_windows == 1 && wherex=="header") {
   document.getElementById('iframe_nav1c').className='iframe_default';
   document.getElementById('iframe_nav2c').className='iframe_default';
 }
 if (countriesid==21) {
     comprefix = "_com";
 } else {
    comprefix = "";
 }
 if (document.getElementById('nav2c_'+thisnav)) {
  firstclick=1;
  nav2c=thisnav;
    if (nav2startdata && wherex=="header") {
   document.getElementById('nav2a_limiter').firstChild.data=nav2startdata;
  }
  //document.getElementById('nav1a').firstChild.data=thisheadline.firstChild.data;
  document.getElementById('nav1a').firstChild.data=thisheadline;
  document.getElementById('nav1a').style.borderBottom='1px solid black';
  document.getElementById('nav2a').className='nava_'+wherex+'_ac'+thisarea+comprefix;
  document.getElementById('nav1a').className='nava_'+wherex+'_ac'+thisarea+comprefix;
  //document.getElementById('gobutton2').src="http://195.226.187.165/images/non_lang/rl_navi_top/ok.gif";
  //document.getElementById('gobutton2').src="/images/shared/ok.gif";
  document.getElementById('nav1c').style.visibility='hidden';
  go_direct_level_1=directlink;
 }
 else if (directlink!='off'){
  location.href= directlink;
 }
}function selectthisnav(whatnav,whatarea,target_url) {
 document.getElementById('nav2a_limiter').firstChild.data=whatnav.firstChild.data;
 location.href= target_url;
}
function jumptox(target_url) {
 //open blank page
 window["countries_window"] = window.open('','countries','scrollbars=yes,menubar=1,location=1,toolbar=1,resizable=1,status=1'); //add other window features here
 // open url in new window
 window["countries_window"].location.href= target_url;
}

function openFAQ(what) {
 // code for faq item template
 for (i = 0; i < document.getElementsByTagName('div').length; i++) {
  if (document.getElementsByTagName('div')[i].className=="faq") {
   document.getElementsByTagName('div')[i].style.display="none";
  }
 }
 if (document.getElementById(what) != null) {
  // show active div
  document.getElementById(what).style.display="block";
 }
}


/// FLASHBUILDER

//Flash Code Builder as workaround for MS vs EOLAS patent problem
function createFlashCode(idOfTarget,requiredFlashVersionNumber,flashWidth,flashHeight,flashMovie) {
 flashCode='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+requiredFlashVersionNumber+',0,0,0" width="'+flashWidth+'" height="'+flashHeight+'" id="myFlash">';
 flashCode+='  <param name="movie" value="'+flashMovie+'" />';
 flashCode+=' <param name="quality" value="high" />';
 flashCode+=' <param name="allowScriptAccess" value="sameDomain" />';
 flashCode+=' <param name=FlashVars value="locale=en_us&clickTag=/software/mx2004/index.html&clickTarget=_self&getURLOK=false" />';
 flashCode+=' <embed flashvars="locale=en_us&clickTag=/software/mx2004/index.html&clickTarget=_self&getURLOK=true" src="'+flashMovie+'" width="'+flashWidth+'" height="'+flashHeight+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="myFlash" allowScriptAccess="sameDomain"></embed>';
 flashCode+='</object>';
 document.getElementById(idOfTarget).innerHTML=flashCode;
}
function createFlashCodeExtend(idOfTarget,requiredFlashVersionNumber,flashWidth,flashHeight,flashMovie) {
 flashCode =' <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version='+requiredFlashVersionNumber+',0,0,0" width="'+flashWidth+'" height="'+flashHeight+'" id="myFlash">';
 flashCode+=' <param name="movie" value="'+flashMovie+'" />';
 flashCode+=' <param name="quality" value="high" />';
 flashCode+=' <param name="allowScriptAccess" value="always" />';
 flashCode+=' <param name="wmode" value="opaque" />';
 flashCode+=' <param name=FlashVars value="locale=en_us&clickTag=/software/mx2004/index.html&clickTarget=_self&getURLOK=false" />';
 flashCode+=' <embed flashvars="locale=en_us&clickTag=/software/mx2004/index.html&clickTarget=_self&getURLOK=true" src="'+flashMovie+'" width="'+flashWidth+'" height="'+flashHeight+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" name="myFlash" allowscriptaccess="always" wmode="opaque"></embed>';
 flashCode+='</object>';
 document.getElementById(idOfTarget).innerHTML=flashCode;
}
// Detect Client Browser type
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
jsVersion = 1.1; // JavaScript helper required to detect Flash Player PlugIn version information
function JSGetSwfVer(i){
 // NS/Opera version >= 3 check for Flash plugin in plugin array
 if (navigator.plugins != null && navigator.plugins.length > 0) {
  if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
   var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
   var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
   descArray = flashDescription.split(" ");
   tempArrayMajor = descArray[2].split(".");
   versionMajor = tempArrayMajor[0];
   versionMinor = tempArrayMajor[1];
   if ( descArray[3] != "" ) {
    tempArrayMinor = descArray[3].split("r");
   } else {
    tempArrayMinor = descArray[4].split("r");
   }
   versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
    flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
   } else {
   flashVer = -1;
  }
 }
 // MSN/WebTV 2.6 supports Flash 4
 else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
 // WebTV 2.5 supports Flash 3
 else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
 // older WebTV supports Flash 2
 else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
 // Can't detect in all other cases
 else {
  flashVer = -1;
 }
 return flashVer;
}
function getFlashVersion()  {
 // loop backwards through the versions until we find the newest version
 for (i=25;i>0;i--) {
  if (isIE && isWin && !isOpera) {
   versionStr = VBGetSwfVer(i);
  } else {
   versionStr = JSGetSwfVer(i);
  }
  if (versionStr == -1 ) {
   return -1;
  } else if (versionStr != 0) {
   if(isIE && isWin && !isOpera) {
    tempArray         = versionStr.split(" ");
    tempString        = tempArray[1];
    versionArray      = tempString .split(",");
   } else {
    versionArray      = versionStr.split(".");
   }
   return versionArray[0];
  }
 }
 return -1;
}



// Cookie handling
function createCookie(name,days)
{
    if (days){
          var date = new Date();
          date.setTime(date.getTime()+(days*24*60*60*1000));
          var expires = "; expires="+date.toGMTString();
         var dateExp = new Date();
         value = dateExp.getTime()+(days*24*60*60*1000) + ":";
     } else {
        var date = new Date();
          date.setTime(date.getTime()+(12*30*24*60*60*1000));
         var expires = "; expires="+date.toGMTString();
         var dateExp = new Date();
         value = dateExp.getTime()+(12*30*24*60*60*1000) + ":";
     }
     var dateCreate = new Date();
     dateCreate = dateCreate.getTime();
     document.cookie = name+"="+value+dateCreate+expires+"; path=/";
}
function readCookie(name)
{
     var nameEQ = name + "=";
     var ca = document.cookie.split(';');
     for(var i=0;i < ca.length;i++)
     {
          var c = ca[i];
          while (c.charAt(0)==' ') c = c.substring(1,c.length);
          if (c.indexOf(nameEQ) == 0) return (c.substring(nameEQ.length,c.length));
     }
     return null;
}
function eraseCookie(name)
{
     createCookie(name,-1);
}
function checkCookie(name,date)
{
    var ca = date.split('.');
    var year = ca[2];
    var month = ca[1];
    var day = ca[0];
    var newDate = new Date(year,month-1,day,14,32,10);
    var now = new Date();
    var value = readCookie(name).split(':');
    alert(Date.parse(newDate) + "----" + Date.parse(now))
    if(value[1]<Date.parse(newDate) && !readCookie(name)) {
        eraseCookie(name);
    }

}
function getUrlParam(f){var d=String(window.location);if(window.location.search!=""){var e=d.split("?");var c=e[1].split("&");for(i=0;i<c.length;i++){var b=c[i].split("=");if(b[0]==f){return b[1]}}}};
