jQuery(document).ready(

    /*
    This function gets loaded when all the HTML, not including the portlets, is
    loaded.
    */

    function() {
    }
);

Liferay.Portlet.ready(

    /*
    This function gets loaded after each and every portlet on the page.

    portletId: the current portlet's id
    jQueryObj: the jQuery wrapped object of the current portlet
    */

    function(portletId, jQueryObj) {
    }
);

jQuery(document).last(

    /*
    This function gets loaded when everything, including the portlets, is on
    the page.
    */

    function() {
    }
);


// =============================================================================
// Flash-Embedding...
// =============================================================================
// These are the user defined globals.
var requiredVersion = 8   // Version the user needs to view site (max 9, min 2)
var useRedirect = false;   // Flag indicating whether or not to load a separat epage
// default alternative-iamge if no link is given:
var default_altimg = "http://www.netbiscuits.com/image/image_gallery?img_id=24356"
// Only set if useRedirect is true...
var flashPage   = "movie.html"    // The location of the flash movie page
var noFlashPage = "noflash.html"  // Page displayed if the user doesn't have the plugin
var upgradePage = "upgrade.html"  // Page displayed if we detect an old plugin
// =============================================================================
// ****************************************
// Do not modify the following functions!!!
// ****************************************

// System globals
var flash2Installed = false;    // boolean. true if flash 2 is installed
var flash3Installed = false;    // boolean. true if flash 3 is installed
var flash4Installed = false;    // boolean. true if flash 4 is installed
var flash5Installed = false;    // boolean. true if flash 5 is installed
var flash6Installed = false;    // boolean. true if flash 6 is installed
var flash7Installed = false;    // boolean. true if flash 7 is installed
var flash8Installed = false;    // boolean. true if flash 8 is installed
var flash9Installed = false;    // boolean. true if flash 9 is installed
var maxVersion = 9;             // highest version we can actually detect
var actualVersion = 0;          // version the user really has
var hasRightVersion = false;    // boolean. true if it's safe to embed the flash movie in the page
var jsVersion = 1.0;            // the version of javascript supported

// Check the browser...looking for ie/win
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;    // true if we're on ie
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; // true if we're on windows

// js1.1 is supported.
jsVersion = 1.1;

// Write vbscript detection on ie win. IE doesn't support regularJS plugins array detection.
if(isIE && isWin){
  document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
  document.write('on error resume next \n');
  document.write('flash2Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
  document.write('flash3Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
  document.write('flash4Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
  document.write('flash5Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');  
  document.write('flash6Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');  
  document.write('flash7Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
  document.write('flash8Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');
  document.write('flash9Installed = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.9"))) \n');
  document.write('<\/SCR' + 'IPT\> \n'); // break up end tag so it doesn't end our script
}

// Javascript Falsh-Detection follows.....
function detectFlash() {  
  // If navigator.plugins exists...
  if (navigator.plugins) {
    // ...then check for flash 2 or flash 3+.
    if (navigator.plugins["Shockwave Flash 2.0"]
        || navigator.plugins["Shockwave Flash"]) {

      var isVersion2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      var flashDescription = navigator.plugins["Shockwave Flash" + isVersion2].description;
      // DEBUGGING
      // alert("Flash plugin description: " + flashDescription);
      var flashVersion = parseInt(flashDescription.substring(16));

      flash2Installed = flashVersion == 2;    
      flash3Installed = flashVersion == 3;
      flash4Installed = flashVersion == 4;
      flash5Installed = flashVersion == 5;
      flash6Installed = flashVersion == 6;
      flash7Installed = flashVersion == 7;
      flash8Installed = flashVersion == 8;
      flash9Installed = flashVersion >= 9;
    }
  }
  
  // set actualVersion to highest detected version.
  for (var i = 2; i <= maxVersion; i++) {  
    if (eval("flash" + i + "Installed") == true) actualVersion = i;
  }
  if(navigator.userAgent.indexOf("WebTV") != -1) actualVersion = 4;  
  
  // DEBUGGING
  // alert("version detected: " + actualVersion);

  if (actualVersion >= requiredVersion) {
    if (useRedirect) {
      if(jsVersion > 1.0) {
        window.location.replace(flashPage);  
      } else {
        window.location = flashPage;
      }
    }
    hasRightVersion = true;                
  } else {  
      if (useRedirect) {
       if(jsVersion > 1.0) {
        window.location.replace((actualVersion >= 2) ? upgradePage : noFlashPage);
      } else {
        window.location = (actualVersion >= 2) ? upgradePage : noFlashPage;
      }
    }
  }
}

detectFlash();

function showFlash(movie, width, height, altimg){
        movie = window.location.protocol+"//"+window.location.host+movie;
        if(altimg == "") altimg = default_altimg;         
        if (!useRedirect) {  
          if(hasRightVersion) { 
                var oeTags =''
                    +'<EMBED SRC="'+movie+'"'
                    +'WIDTH="'+width+'" HEIGHT="'+height+'"'
                    +'PLAY="true"'
                    +'LOOP="false"'
                    +'QUALITY="high"'
                    +'MENU="false"'
                    +'TYPE="application/x-shockwave-flash"'
                    +'PLUGINSPAGE="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">'
                    +'<\/EMBED>';
                document.write(oeTags);
          } else {  // flash is too old or we can't detect the plugin - height, width are required!
            var alternateContent = '<a href="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"><IMG SRC="'+altimg+'" HEIGHT="'+height+'" WIDTH="'+width+'"></a>';
            document.write(alternateContent);  // insert non-flash content
          }
        }
}
//------------------------------------------------------------------
//-------------------END-Flash-------------------------------------
//------------------------------------------------------------------

//----------------------------------
// Change Language (AJAX)....
//----------------------------------
function requestObject() {
    var tmpXmlHttpObject;
    if (window.XMLHttpRequest) { 
        tmpXmlHttpObject = new XMLHttpRequest();
    } else if (window.ActiveXObject) { 
        tmpXmlHttpObject = new ActiveXObject("Microsoft.XMLHTTP");
    }
    return tmpXmlHttpObject;
}

var language = requestObject();
var language_var = "";
function response(id, ok, err) {
    if(language.readyState == 4){
       if (language.status==200) {
        var response = language.responseText;
        
        if(language_var.toString() == "de_DE") {
            document.getElementById("language").innerHTML = 'OK... Falls sich die Sprache nicht automatisch &auml;ndert, bitte <a href="javascript:location.reload()">HIER</a> klicken';        
        } else {
            document.getElementById("language").innerHTML = 'OK... If the page will not change the language, <a href="javascript:location.reload()">CLICK</a> here';
        }
        setTimeout(location.reload(),1800);
      } else 
                document.getElementById("language").innerHTML = 'err';
    }
}

function changeLanguage(link,lang){
    language_var = lang;
    if(language_var.toString() == "de_DE") {
        document.getElementById('language').innerHTML = 'Sprache wird ge&auml;ndert...';
    } else {
        document.getElementById('language').innerHTML = 'Changing language...'; 
    }
    language.open('get',link );
    language.onreadystatechange = response;
    language.send(null);
}
//----------------------------------


//--------E---Mail----Protection-----
function showMail(name, hostname, tld){
    var dom = hostname;
    var at = "@"; var m = "mail"; var t = "to";
    document.write('<a href=\"'+m+t+':'+name+at+dom+'.'+tld+ '\">'+name+at+dom+'.'+tld+'</a>');
}//----------------------------------


//-------Get-URL-Params---------------
function getURLParams()
   {
    eval_temp = "";
    var url   = window.location.search;
    url = url.substr(1, url.length);
    if (url != "")  {
      liste = url.split("&");
      for (i=0;i<=liste.length-1;i++) {
          temp = liste[i].split("=");
          if(typeof temp[1] != 'undefined'){
          temp[1]=temp[1].replace(/\+/g," ");
          temp[1]=unescape(temp[1]);
          eval_temp +="var __" + checkFormData(temp[0]) + "='" + checkFormData(temp[1])+"';";
        }
       } 
    return  eval_temp;    
    } 
     }
eval(getURLParams()); 
//-----------------------------------


//-------Google-Conversions-----------
function googleConversionsCode(id, lang){
    if(lang == "") lang = "en_US"; 
    var gcons =''
    +'<script type="text/javascript">'
    +"var google_conversion_type = 'landing';"
    +'var google_conversion_id = '+id+';'
    +'var google_conversion_language = "+lang+";'
    +'var google_conversion_format = "1";'
    +'var google_conversion_color = "666666";'
    if(typeof __gad != 'undefined'){ 
    	__gad = __gad;
    	gcons += 'var google_conversion_ad = "'+__gad+'";'
    }
    gcons +='</script>'
    //+'<script language="JavaScript" src="http://www.googleadservices.com/pagead/conversion.js"></script>'
    +'<script language="JavaScript" src="https://ssl.googleadservices.com/pagead/conversion.js"></script>'
    +'<noscript>'
    //+'<img height=1 width=1 border=0 src="http://www.googleadservices.com/pagead/conversion/'+id+'/extclk?script=0">'
    +'<img height=1 width=1 border=0 src="https://ssl.googleadservices.com/pagead/conversion/'+id+'/extclk?script=0">'
    +'</noscript>';

    document.write(gcons);
}
//-----------------------------------


// --------- start syncronizeBoxSize() ---------
function syncronizeBoxSize(x, y) {
	
	var obj1 = '';
	var obj2 = '';
	
	if (navigator.appName.indexOf("Explorer") != -1){
		// IE
		obj1 = document.all[x];
		obj2 = document.all[y];
	}else{
		// Firefox
		obj1 = document.getElementById(x);
		obj2 = document.getElementById(y);
	}
	
	if (navigator.appName.indexOf("Explorer") != -1){
		
	}else{
		if(obj1 != null && obj2 != null){
			if(obj1.offsetHeight>obj2.offsetHeight) {
				obj2.style.height=obj1.offsetHeight+'px';
			} else {
				obj1.style.height=obj2.offsetHeight+'px';
			}
		}
	}
}
// --------- end syncronizeBoxSize() ------------


function showLoginSlider(){
   //document.getElementById("login-slider").top = mouseY+"px" ;
   //document.getElementById("login-slider").left = mouseX+"px";
   document.getElementById("login-slider").top = "100px" ;
   document.getElementById("login-slider").left = "100px";
   document.getElementById("login-slider").display="block";
}


// --------- start securityFormFilter ----------

    function checkFormData(str){
        if(str != ""){
	        //str = str.replace(//, "");
	        str = str.replace(/</, "&lt;");
	        str = str.replace(/>/, "&gt;");
	        str = str.replace(/&/, "&amp;");
	        str = str.replace(/"/, "&quot;");
	        str = str.replace(/'/, "&apos; ");
	        str = str.replace(/´/, "&acute;");
	        str = str.replace(/`/, "");
	        str = str.replace(/\(/, "&#40;");
	        str = str.replace(/\)/, "&#41;");
	        str = str.replace(/\[/, "&#91;");
	        str = str.replace(/\]/, "&#92;");
	        str = str.replace(/{/, "&#123;");
	        str = str.replace(/}/, "&#124;");
	        str = str.replace(/#/, "&#35;");
	        str = str.replace(/%/, "&#37;");
	        str = str.replace(/:/, "&#58;");
	        str = str.replace(/;/, "&#59;");
	        str = str.replace(/\+/, "&#43;");
	        str = str.replace(/-/, "&#45;");
	        str = str.replace(/=/, "&#61;");
	        str = str.replace(/@/, "&#64;");
	        str = str.replace(/\|/, "&#124;");
	        
	        str = str.replace(/javascript/, "").replace(/Javascript/, "").replace(/JAVASCRIPT/, "");
        }else{
            str = "";
        }
        return str;
    }
// --------- end securityFormFilter ------------