

var pagerLoadId=0;
function pagerLoad(__id) {
  pagerLoadId=__id;
  $("#prn"+__id).prepend('<span id="pageLoadIcon">&nbsp;</span>');
}

function pagerReady() {  
  $("#pageLoadIcon").remove();
}


(function($) {
    $.fn.fadeInOut = function(options) {
        var defaults = {    		 
    			speed: 			800,
          cnt:0			
    		}; 
    		var options = $.extend(defaults, options); 
		        options.total = $(".slogans").length;
        return this.each(function() {$.fadeInOut(this, options);});
    };

    $.fadeInOut = function(cObj, options) {
     
      options.cnt++;      
 
      var src=$(cObj).text();      
      if (jQuery.browser.msie)  {
         $(".slogans SPAN").html("");
      } else {
        $(cObj).html('<img src="'+src+'"/>');
      }
      
      
      $(cObj).css("z-index",options.cnt+"");
      $(cObj).hide();
      

       
      if( options.cnt==1) $(cObj).addClass("slogans-first");  
       
      if(options.cnt==options.total) {
        $(cObj).addClass("slogans-last");
        $("#slogans").show();     
       
         showFirst();
      }
     
      
      function showFirst() {
          $(".slogans-first").css('display','block');
          $(".slogans-first").addClass("slogans-cur"); 
          $(".slogans-first").next(".slogans").addClass("slogans-next");
           
          if(options.total==1) return;
          showNext();
     
      }
      function showNext() {
     
         setTimeout( function(){    
           if (jQuery.browser.msie)  {    
            $(".slogans-cur").hide();
           } else $(".slogans-cur").fadeOut(2000);
           
          if (jQuery.browser.msie)  {
           $(".slogans-next").show(); 
           } else $(".slogans-next").fadeIn(2000);
                     
           $(".slogans-cur").removeClass("slogans-cur"); 
           $(".slogans-next").addClass("slogans-cur"); 
           $(".slogans-next").removeClass("slogans-next"); 
            
           if($(".slogans-cur").is('.slogans-last')) {               
               $(".slogans-first").addClass("slogans-next");                
           } else  $(".slogans-cur").next(".slogans").addClass("slogans-next");
            showNext();
        },10000);
      }
      
       
    }
    
})(jQuery);


	jQuery.download = function(url, data, method){
	//url and data options required

	if( url && data ){ 
		//data can be string of parameters or array/object
		data = typeof data == 'string' ? data : jQuery.param(data);
		//split params into form inputs
		var inputs = '';
		jQuery.each(data.split('&'), function(){ 
			var pair = this.split('=');
			inputs+='<input type="hidden" name="'+ pair[0] +'" value="'+ pair[1] +'" />'; 
		});
		//send request
		jQuery('<form enctype="multipart/form-data" action="'+ url +'" method="'+ (method||'post') +'">'+inputs+'</form>')
		.appendTo('body').submit().remove();
	};
};


 $(document).ready(function(){
	      $("A.download").click(function(e){$.download(this.href,'');});
	      $(".slogans").fadeInOut();
// mouse over functions
      	$(".hover").mouseover(function(e){
     	      $(this).removeClass("bodytext"); 
     	      $(this).addClass("bodytextHover"); 
     	      $(this).prepend('<span id="arrow">&nbsp;</span>');
     	      
       	});
       	$(".hover").mouseout(function(e){
     	      $(this).removeClass("bodytextHover"); 
     	      $(this).addClass("bodytext"); 
            $("#arrow").remove(); 
     	  });
         
         // Nav Lang
         /*
         html > body > ul #navLang .nav > li .act > a .flag-en
         */
          
         	
         
        	$("#navLang .act").mouseover(function(e){
        	  	$("#navLang .act").addClass("ieOVER"); 
            	$("#navLang .act UL").show();
          });
           
        	$("#navLang .act").mouseout(function(e){
            	$("#navLang .act UL").hide();
            	$("#navLang .act").removeClass("ieOVER"); 
          });
          
              	   	
           
   });
   

    	
    	
    	
/*** MOUSE OVER AND OUTS FOR WINDOWS */
var windowDisplay=false;    	
var tbUrl='';
var thickbox=false;
var timeoutID = -1;
var timeOut=1500;
var mx=255;var my=550;

var quickInfo = {
  disable:false,
  show: function(uri,primary) {
  
    var uid = uid;
    var regEx = /tx_bb\[uid\]=([0-9]*)/;
	      uid = regEx.exec(uri);
	      
	
    var primary=primary;
    this.cancel();
    var self = this;
    
    /** replace params only if mod_rewrite*/
    if(realUrl=='1') {
     	var queryString = uri.replace(/^[^\?]+\??/,'');
    	var tbUrl       = uri.replace(/\?+(.*)/,'')+"?type=99";
    } else {        
    	var queryString = uri.replace(/^[^\?]+\??/,'');
    	var tbUrl    = uri.replace(/\?+(.*)/,'');
    	tbUrl=tbUrl.replace(/\.0\./,'.99.'); /* typeNum */
    	var regEx = /(L=[0-9]*)/;
    	var lang = regEx.exec(queryString);
    	tbUrl+="?";
    	if(lang) tbUrl+=lang[0];  
     
  	}
  	
    tbUrl=tbUrl.replace ('Ã', '%C3%96');/* IE 6 fix*/
      	
  
  	var requestURI=tbUrl+'&primary='+primary+'&no_cache=1';
 
    if(uid!=undefined){
        uid = uid[1];
        requestURI+='&tx_bb[uid]='+uid;        
    }    
   
  	$("#window").fadeTo("normal",0);
    if($(".tabMenu").tabToogle) $(".tabMenu").tabToogle(false);           
    this.timeoutID = window.setTimeout(function() { 
    if(quickInfo.disable==true)return;
      jQuery.get(requestURI, {}, function(data){
    
        if (window.innerWidth) {
            _mx=(window.innerWidth/2)-210;
        } else if (document.body && document.body.offsetWidth) {            
            _mx=(document.body.offsetWidth/2)-210;
        }
        // _my=my-250;
        _my=my-350;
        
    	 if(document.getElementById("clickDisabler") != null)$("#clickDisabler").remove();    
    	 if(document.getElementById("window") != null)$("#window").remove();
       $("body").append('<div id="clickDisabler"></div><div id="window" style="top:'+_my+'px;left:'+_mx+'px">'+data+'</div>');  
       $("#clickDisabler").mouseover(function(e){window.clearTimeout(this.timeoutID);return false;});
       
     });
      }, 500,uri,tbUrl );
  },
      
  

  cancel: function() {           
    if(typeof this.timeoutID == "number" || document.getElementById("window") != null) {
         
     if(document.getElementById("window") != null)$("#window").remove();
 
      $("#window").hide();
      window.clearTimeout(this.timeoutID);
      delete this.timeoutID;    
      if(document.getElementById("clickDisabler") != null) {
      this.clickEnableID = window.setTimeout(function() { 
         $("#clickDisabler").remove();
         if(document.getElementById("right") != null) {
            quickInfo.highlightAll("right");   
            quickInfo.highlightAll("normal");
        }        
        window.clearTimeout(this.clickEnableID);
        
        this.clickEnableID=null;
        return;
        },500);  
      }
    }
    
  },
  
  unbind:function() {
      thickbox=true;
    //  $("#window").mousemove=function(){ $(this).hide();}
       
  },
  isInside:false,
  isDynamic:false,
  inside:function(x,y) {
    quickInfo.isInside=false;
    quickInfo.isDynamic=true;
    if ( (y < 890 && y > 300) && (x < 650 && x > 489)) {
      quickInfo.isInside=true;     
    }
    // my=y;
    // mx=x;  
  },
  
  unglight:function(ref){
        
   $( "#"+ref.id+" A").removeClass("unlight");   
   $( "#"+ref.id+" A").addClass("highlight");
  // $( "#"+ref.id+" A.highlight").fadeTo("normal", 1);
   
    
  },
  
  highlightAll:function(id){
    if($(".tabMenu").tabToogle ) $(".tabMenu").tabToogle(true); 
    if(id) {
    
       //if (jQuery.browser.msie==false && jQuery.browser.safari==false ) $("#"+id+" .unlight").fadeTo("fast", 1);    
       $("#"+id+" A").removeClass("unlight");
       $("#"+id+" A").removeClass("highlight");        
    } else {
    //if (jQuery.browser.msie==false && jQuery.browser.safari==false) $("#right .unlight").fadeTo("fast", 1);     
    //if (jQuery.browser.msie==false && jQuery.browser.safari==false) $("#normal .unlight").fadeTo("fast", 1);
     
     $( "#normal A").removeClass("unlight");
     $( "#right A").removeClass("unlight");

     $( "#normal A").removeClass("highlight");
     $( "#right A").removeClass("highlight");
   }
  },
  
  highlight:function(ref){
   var refParent = $(ref).parent().parent().get(0);
  
   if( $( "#"+refParent.id+" A").is(".highlight") ) {
       if ( $("#"+ref.id).is(".highlight") ) { 
       } else {
       $( "#"+refParent.id+" A.highlight").toggleClass("unlight");
       $( "#"+refParent.id+" A.highlight").removeClass("highlight");
      
     //if (jQuery.browser.msie==false && jQuery.browser.safari==false)   $( "#"+refParent.id+" A.unlight").fadeTo(0.01,0.33);
        $( "#"+ref.id).removeClass("unlight");
        $( "#"+ref.id).addClass("highlight"); 
      }
        
   } else { 
     $( "#"+refParent.id+" A").removeClass("highlight");   
     $( "#"+refParent.id+" A").addClass("unlight");
     
     $( "#"+ref.id).removeClass("unlight");
     $( "#"+ref.id).addClass("highlight");
     
 //   if (jQuery.browser.msie==false && jQuery.browser.safari==false) $( "#"+refParent.id+" A.unlight").fadeTo(1,0.33);
   }
   
  //if (jQuery.browser.msie==false && jQuery.browser.safari==false) $( "#"+refParent.id+" A.highlight").fadeTo(1, 1);
   
  }
 
};


function bookmark(){

  var bmUrl=location.href;
  var bmTitle=(document.getElementsByTagName("title")[0].text);
 
  if (window.sidebar){
    // firefox
    window.sidebar.addPanel(bmTitle,bmUrl,"");
  } else if(window.opera && window.print) {
    // opera
    var elem = document.createElement('a');
    elem.setAttribute('href',bmUrl);
    elem.setAttribute('title',bmTitle);
    elem.setAttribute('rel','sidebar');
    elem.click();
    } else if(document.all)  {
    // ie
    window.external.AddFavorite(bmUrl,bmTitle);
    }else {
      alert("Sorry! Your browser doesn't support this function. Please bookmark this page manually.");
    }
    return false;
}

 


/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};

