﻿function querySt(ji) {
 hu = window.location.search.substring(1);
 gy = hu.split("&");
 for (i=0;i<gy.length;i++) {

 ft = gy[i].split("=");
 if (ft[0] == ji) {
 return ft[1];
 }
 }
}

/* ::: - - - - - initonAccordion Function - - - - - ::: */
function initonAccordion() {

  var expand = querySt("expand");
  if(expand){
    var myexpands = expand.split('|');
  }

  $.each( $("#maincontent div.onAccordion > div"), function(i, n){
    $(n).children("h2:first-child").addClass("hide");
    jQuery(n).before("<h2 class='onAccHead'>"+$(n).children("h2:first-child").html()+"</h2>");

    if ($(n).hasClass('open')) {
      $(n).prev(".onAccHead").addClass("selected");
    } else {
      $(n).addClass("hide");
        if(expand){
          for (j=0;j<myexpands.length;j++){
            if(myexpands[j] == i+1) {
            $(n).prev(".onAccHead").addClass("selected");
            $(n).removeClass("hide");
            
            if(j == 0) {
var topoffset = $(n).offset().top;
window.scrollTo(0,topoffset - 30);
            }

          }
        }
      }
    }
    
  }); 

  $.each( $("#margi div.onAccordion > div"), function(i, n){
    $(n).children("h3:first-child").addClass("hide");
    jQuery(n).before("<h3 class='onAccHead'>"+$(n).children("h3:first-child").html()+"</h3>");

    if ($(n).hasClass('open')) {
      $(n).prev(".onAccHead").addClass("selected");
    } else {
      $(n).addClass("hide");
        if(expand){
          for (j=0;j<myexpands.length;j++){
            if(myexpands[j] == i+1) {
            $(n).prev(".onAccHead").addClass("selected");
            $(n).removeClass("hide");
            
            if(j == 0) {
var topoffset = $(n).offset().top;
window.scrollTo(0,topoffset - 30);
            }

          }
        }
      }
    }
    
  }); 

  $(".onAccHead").click(function() {
    $(this).addClass("current");
    
    $.each( $(this).parent(".onAccordion").children(".selected:not('.current')"), function(i, n){
      $(n).next("div").animate({ height: 'toggle', opacity: 'toggle'},{duration: 300,
        complete:function(){ 
          $(n).parent(".onAccordion").children(".onAccHead:not('.current')").removeClass("selected");
      } });
    });
    
    $(this).next("div").animate({ height: 'toggle', opacity: 'toggle'},{duration: 300, 
      complete:function(){
        $(this).prev(".onAccHead").toggleClass("selected");  
        $(this).prev(".onAccHead").removeClass("current");
    } });
  });

  $("a[name='closeall']").click(function() {
    var clsall = $(this);
    var topoffsetbefore = $(this).offset().top;
    $(this).parent().parent("div").prevAll().each(function(i){
      if ($(this).hasClass("expands") ){
        var scrollTop= $(window).scrollTop();
        var topoffsetafter = $(clsall).offset().top;
        window.scrollTo(0,scrollTop - (topoffsetbefore - topoffsetafter) );

        return false;
      }
      $(this).children("h2").removeClass("selected").next("div.onAccordionContent, div.open").css("display", "none");
    });
    return false;
  });
  $("a[name='closeall']").addClass("closeall");

}




/* ::: - - - - - initTabs Function - - - - - ::: */
function initTabs() {
	
  var tab = querySt("tab");

  if(tab){
	  if(tab.indexOf('.') == -1){
			tab = "1."+tab;
		}
	  var mytab = tab.split('.');
  }
	
  $("div.generate-ui-tab").prepend("<ul></ul>");
  
  $.each( $("div.generate-ui-tab > .supertab > h2"), function(i, n){
    var test = $(n).html();
    $(n).parent(".supertab").attr("id","tab_"+i+"");
    $(n).parent(".supertab").parent(".generate-ui-tab").children("ul").append("<li><a href='#tab_"+i+"'>"+test+"</a></li>");
    $(n).addClass("hide");
  });
  
  $.each( $("div.generate-ui-tab"), function(j, m){  
    $.each( $(m).children(".supertab"), function(i, n){  
                                                 
			if(tab) {
			 var tabcnt = j +1;
			 var cnt = i +1;
			 if(mytab[0] == tabcnt && mytab[1] == cnt) {
					$(this).parent(".generate-ui-tab").tabs({ fx: { height: 'toggle', opacity: 'toggle' },selected: i });
				}
			} else {
				if($(n).parent(".generate-ui-tab").children().is(".defaulttab")){
					if($(this).is(".defaulttab")){
						$(this).parent(".generate-ui-tab").tabs({ fx: { height: 'toggle', opacity: 'toggle' },selected: i });
					} 
				} else {
				 $(this).parent(".generate-ui-tab").tabs({ fx: { height: 'toggle', opacity: 'toggle' }} );
				}
			}
			
    });
  });
}

function setBookmark(lang)
{
  bookmarkurl = location.href;
  if (document.all) {
     var text = document.title;
     text = text.replace(/:/ ,"");
     text = text.replace(/\*/ ,"");
     text = text.replace(/\?/ ,"");
     text = text.replace(/\\/ ,"");
     text = text.replace(/"/ ,"");
     text = text.replace(/</ ,"");
     text = text.replace(/>/ ,"");
     text = text.replace(/|/ ,"");
     window.external.AddFavorite(bookmarkurl,text);
  } else {
    alert('Your Browser does not support this feature!');
  }
}

function addTopicons() {
  jQuery("body").append('<div id="toparrows"></div>');
  jQuery("#toparrows").height(jQuery("#maincontent").height());
  var viewportHeight = jQuery(window).height();
  var toparrowsOffsett = jQuery("#toparrows").offset().top;
  for(var i = 1; i<((jQuery("#maincontent").height() +toparrowsOffsett) / viewportHeight); i++){
    var mtop;
    if(i == 1){
      mtop = viewportHeight - toparrowsOffsett;
    } else {
      mtop = viewportHeight - 10;
    }
    jQuery("#toparrows").append('<a href="#header" style="margin-top:'+mtop+'px">top</a>');
  }
}

/*zoom*/
function zoom(factor) {
    var size = "100%";
    var obj = document.getElementById("aspnetForm");
  if(obj!=null) {
    if (obj.style.fontSize != null && obj.style.fontSize != ""){ 
      size = obj.style.fontSize;
    }
    size = Number(String(size).substring(0, String(size).indexOf("%")))
    if (size > 20 && size < 200) size = size + factor;
    /*if (size == 100 && factor > 0) size = size + factor;*/
    if (factor == 0) size = 100;
    setPersFontSize(size + "%");
    loadZoom(size);

    if ((navigator.appName == "Netscape" && navigator.appCodeName != "Mozilla") || navigator.appName == "Opera") { location.reload(); }
}
}

function loadZoom(mysize) {
    var newSize = getPersFontSize();
    if (newSize == "100%" && mysize != undefined) { newSize = mysize + "%"; }

    var obj = document.getElementById("aspnetForm");
    if(obj!=null)
      obj.style.fontSize = newSize;
}


function setPersFontSize(fontSize) {

     var date = new Date();
      //30 Tage
     date.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000));

    document.cookie = "fontSize=" + fontSize + ";expires=" + date.toGMTString();
}


function getPersFontSize() {
    var fontSize = "100%";

    if (document.cookie) {
        var val = document.cookie
        var idxStart = val.indexOf("fontSize=")
        var idxEnd = val.indexOf(";", idxStart);

        if (idxEnd < 0) { idxEnd = val.length; }
        if (idxStart >= 0) { fontSize = val.substring(idxStart + "fontSize=".length, idxEnd); }
    }
    else {
        setPersFontSize(fontSize);
    }
    return fontSize;
}
function createCookie(name, value, days) {
    if (days) {
        var date = new Date();
        date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
        var expires = "; expires=" + date.toGMTString();
    }
    else expires = "";
    document.cookie = name + "=" + value + 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;
}





var currentvalue= 10;
var intervalId = 0;

function countDown(){
  if(currentvalue > 0){
    currentvalue -= 1;
    $("#cntdwn").html(currentvalue);
  }
  if(currentvalue == 0){
    $("#cntdwn").html("0");
    clearInterval ( intervalId );
    if ( $("body").hasClass("de") ){
      window.location = "http://www.currenta.de/";
    } else {
      window.location = "http://www.currenta.com/";
    }
  }
}

jQuery(function(){
  loadZoom();


  $("img[src='http://www.presse.bayer.de/baynews/baynews.nsf/4a6223d2b5e7ed5bc12571f400362eb9/f97988d7cdadd1bcc12577c90058000a/b1/0.3950?OpenElement&FieldElemFormat=jpg']").css({ "font-size":"10px" });
  $("img[src='http://www.presse.bayer.de/baynews/baynews.nsf/4a6223d2b5e7ed5bc12571f400362eb9/d6a166bf41c1545ec12577c90059d786/b1/0.396A?OpenElement&FieldElemFormat=jpg']").css({ "font-size":"10px" });

  $("body#home a[href*='www.currenta']").click(function() {

    if ( $("body").hasClass("de") ){
      $("body").append('<div id="dsclmr" style="visibility: visible;"><img class="close" alt="schließen" src="/img/system/close.gif" /><img src="/img/system/currenta-de.png" alt="CURRENTA" class="clogo" /><p id="dsclmrdescription"><strong>CURRENTA betreibt als mehrheitlich zur Bayer AG geh&ouml;rende Servicegesellschaft den CHEMPARK an den Standorten Leverkusen, Dormagen und Krefeld-Uerdingen.<\/strong><br/><br/>In <span id="cntdwn">10<\/span> Sekunden werden Sie automatisch auf die Website <a href="http://www.currenta.de">http://www.currenta.de<\/a> weitergeleitet.<\/p><\/div>');
    } else {
      $("body").append('<div id="dsclmr" style="visibility: visible; height:21.8em;"><img class="close" alt="schließen" src="/img/system/close.gif" /><img src="/img/system/currenta-en.png" alt="CURRENTA" class="clogo" /><p id="dsclmrdescription"><strong>The service company CURRENTA, in which Bayer AG owns a majority stake, is the manager and operator of CHEMPARK, with sites in Leverkusen, Dormagen and Krefeld-Uerdingen. <\/strong><br/><br/>You will be forwarded automatically to <a href="http://www.currenta.com">http://www.currenta.com<\/a> in <span id="cntdwn">10<\/span> seconds.<\/p><\/div>');
    }

    intervalId = setInterval( "countDown()", 1000 );

    $("#dsclmr > .close").click(function() {
      if ( $("body").hasClass("de") ){
        window.location = "http://www.currenta.de/";
      } else {
        window.location = "http://www.currenta.com/";
      }
    });

    return false;
  });


  $("a[name=video]").addClass("video");
  $("a[name=audio]").addClass("audio");
  $("a[name=pdf]").addClass("pdflink");
  $("a[name=facebook]").addClass("facebook");
  $("a[name=twitter]").addClass("twitter");
  $("a[name=back]").addClass("bck");

  $("a[title=video]").addClass("video");
  $("a[title=audio]").addClass("audio");
  $("a[title=pdf]").addClass("pdflink");

  $("h3 > span > span[class=links]").parent().parent("h3").addClass("links");
  $("h3 > span > span[class=events]").parent().parent("h3").addClass("events");
  $("h3 > span > span[class=webspecials]").parent().parent("h3").addClass("webspecials");
  $("h3 > span > span[class=podcast]").parent().parent("h3").addClass("podcast");
  $("h3 > span > span[class=publications]").parent().parent("h3").addClass("publications");

  initonAccordion();
  initTabs();
if(jQuery("body").attr("id") != "popup") {
  addTopicons();
}
  if($.browser.msie){
    jQuery("body.de #footer >div.inline > a.recommend").before('<a href="javascript:setBookmark()" class="bookmark">Seite bookmarken</a>');
    jQuery("body.en #footer >div.inline > a.recommend").before('<a href="javascript:setBookmark()" class="bookmark">Bookmark this page</a>');
  }

  $("input.nocomplete").attr("autocomplete", "off");

    jQuery('ul#nav').superfish();
    jQuery('ul.sf-vertical').superfish();


//financialreports

  jQuery(".emphlast > tbody > tr").children("td:last-child").addClass("em");
  jQuery(".newtable > tbody > tr > td > p.x0-allgem-fussnote-5-5pt").parent().addClass("newlegal");
  jQuery(".newtable > tbody > tr > td > p.x0-allgem-fussnote-5pt").parent().addClass("newlegal");


for (i = 1; i <= 40; i++) {
  jQuery(".col"+i+"emph > tbody > tr").children("td:nth-child("+i+")").addClass("em");
  jQuery(".col"+i+"borderright > tbody > tr").children("td:nth-child("+i+")").addClass("borderright");
  jQuery(".colth"+i+"borderright > tbody > tr").children("th:nth-child("+i+")").addClass("borderright");
}
  jQuery("table.separate").css({"border-collapse" : "separate"});
  jQuery("table.separate").attr({"cellpadding" : "0"});
  jQuery("table.separate").attr({"cellspacing" : "0"});

  jQuery("table.separate > tbody > tr.bold").next("tr.bold").children("td").css({"border-top" : "0"});

jQuery("td:empty").text(" ");

	jQuery(".newtable > tbody > tr:first-child").addClass("em");

  jQuery("table.newtable > tbody > tr > td:first-child").addClass("leftaligned");
  jQuery("table.newtable > tbody > tr > th:first-child").addClass("leftaligned");

jQuery(".newtable > tbody > tr:not(.blank) > td").hover(
      function () {
        jQuery(this).parent("tr").addClass("betterhover");
      }, 
      function () {
        jQuery(this).parent("tr").removeClass("betterhover");
      }
    );


    jQuery("#divfixed").click(function () { 
      jQuery(this).hide();
      jQuery("#container").hide();
      jQuery("#container").empty();
      jQuery("body").css({ overflow:"auto" });
    });

  jQuery("#teaser> div.teaser:first-child").addClass("frst");

  });



jQuery.getPos = function (e)
{
	var l = 0;
	var t  = 0;
	var w = jQuery.intval(jQuery.css(e,'width'));
	var h = jQuery.intval(jQuery.css(e,'height'));
	var wb = e.offsetWidth;
	var hb = e.offsetHeight;
	while (e.offsetParent){
		l += e.offsetLeft + (e.currentStyle?jQuery.intval(e.currentStyle.borderLeftWidth):0);
		t += e.offsetTop  + (e.currentStyle?jQuery.intval(e.currentStyle.borderTopWidth):0);
		e = e.offsetParent;
	}
	l += e.offsetLeft + (e.currentStyle?jQuery.intval(e.currentStyle.borderLeftWidth):0);
	t  += e.offsetTop  + (e.currentStyle?jQuery.intval(e.currentStyle.borderTopWidth):0);
	return {x:l, y:t, w:w, h:h, wb:wb, hb:hb};
};
jQuery.getClient = function(e)
{
	if (e) {
		w = e.clientWidth;
		h = e.clientHeight;
	} else {
		w = (window.innerWidth) ? window.innerWidth : (document.documentElement && document.documentElement.clientWidth) ? document.documentElement.clientWidth : document.body.offsetWidth;
		h = (window.innerHeight) ? window.innerHeight : (document.documentElement && document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.offsetHeight;
	}
	return {w:w,h:h};
};
jQuery.getScroll = function (e) 
{
	if (e) {
		t = e.scrollTop;
		l = e.scrollLeft;
		w = e.scrollWidth;
		h = e.scrollHeight;
	} else  {
		if (document.documentElement && document.documentElement.scrollTop) {
			t = document.documentElement.scrollTop;
			l = document.documentElement.scrollLeft;
			w = document.documentElement.scrollWidth;
			h = document.documentElement.scrollHeight;
		} else if (document.body) {
			t = document.body.scrollTop;
			l = document.body.scrollLeft;
			w = document.body.scrollWidth;
			h = document.body.scrollHeight;
		}
	}
	return { t: t, l: l, w: w, h: h };
};
jQuery.intval = function (v)
{
	v = parseInt(v);
	return isNaN(v) ? 0 : v;
};
jQuery.fn.ScrollTo = function(s) {
	o = jQuery.speed(s);
	return this.each(function(){
		new jQuery.fx.ScrollTo(this, o);
	});
};
jQuery.fx.ScrollTo = function (e, o)
{
	var z = this;
	z.o = o;
	z.e = e;
	z.p = jQuery.getPos(e);
	z.s = jQuery.getScroll();
	z.clear = function(){clearInterval(z.timer);z.timer=null};
	z.t=(new Date).getTime();
	z.step = function(){
		var t = (new Date).getTime();
		var p = (t - z.t) / z.o.duration;
		if (t >= z.o.duration+z.t) {
			z.clear();
			setTimeout(function(){z.scroll(z.p.y, z.p.x)},13);
		} else {
			st = ((-Math.cos(p*Math.PI)/2) + 0.5) * (z.p.y-z.s.t) + z.s.t;
			sl = ((-Math.cos(p*Math.PI)/2) + 0.5) * (z.p.x-z.s.l) + z.s.l;
			z.scroll(st, sl);
		}
	};
	z.scroll = function (t, l){window.scrollTo(l, t)};
	z.timer=setInterval(function(){z.step();},13);
};




// Checks the browser and adds classes to the body to reflect it.

jQuery(document).ready(function(){
    
    var userAgent = navigator.userAgent.toLowerCase();
    $.browser.chrome = /chrome/.test(navigator.userAgent.toLowerCase()); 
    
    // Is this a version of IE?
    if($.browser.msie){
        $('body').addClass('browserIE');
        
        // Add the version number
        $('body').addClass('browserIE' + $.browser.version.substring(0,1));
    }
    
    
    // Is this a version of Chrome?
    if($.browser.chrome){
    
        $('body').addClass('browserChrome');
        
        //Add the version number
        userAgent = userAgent.substring(userAgent.indexOf('chrome/') +7);
        userAgent = userAgent.substring(0,1);
        $('body').addClass('browserChrome' + userAgent);
        
        // If it is chrome then jQuery thinks it's safari so we have to tell it it isn't
        $.browser.safari = false;
    }
    
    // Is this a version of Safari?
    if($.browser.safari){
        $('body').addClass('browserSafari');
        
        // Add the version number
        userAgent = userAgent.substring(userAgent.indexOf('version/') +8);
        userAgent = userAgent.substring(0,1);
        $('body').addClass('browserSafari' + userAgent);
    }
    
    // Is this a version of Mozilla?
    if($.browser.mozilla){
        
        //Is it Firefox?
        if(navigator.userAgent.toLowerCase().indexOf('firefox') != -1){
            $('body').addClass('browserFirefox');
            
            // Add the version number
            userAgent = userAgent.substring(userAgent.indexOf('firefox/') +8);
            userAgent = userAgent.substring(0,1);
            $('body').addClass('browserFirefox' + userAgent);
        }
        // If not then it must be another Mozilla
        else{
            $('body').addClass('browserMozilla');
        }
    }
    
    // Is this a version of Opera?
    if($.browser.opera){
        $('body').addClass('browserOpera');
    }
    
      $("div.zoomdiv > a > img").each(function(index) {
    
    var zdWidth = $(this).width();

    if (zdWidth == "140") {
      $(this).parent("a").parent("div.zoomdiv").css("width", "11.7em");
    }
  });

});







function onEnterSearch(e, input) {
    if (!e) var e = window.event;

    if (e.keyCode)
        code = e.keyCode;
    else if (e.which)
        code = e.which;

    if (code == 13) {
       return submitPageSearch(input);
    }
    return true;

}

function submitPageSearch(input)
{
    if (input.value.replace(' ','')!='' && input.value != 'Ihr Suchbegriff') {
        document.location.href = 'onpublix-search.aspx?searchvalue=' + encodeURI(input.value).replace(/\+/g, "%2b");

        return false;
    }
}


function openPodcast(theURL)
{
    winName = window.open(theURL,'Podcast','location=no,menubar=no,resizable=no,scrollbars=yes,status=no,toolbar=no,width=938,height=756');
    if(winName == null || winName.closed){
    	window.open(theURL,winName,features);
    }
    else{winName.location.href = theURL;}
    if (!winName.closed)
    winName.focus();
}


function getMag(swf, url) {
	  getMag2010(url, document.location.href,'/swf/teilkonzerne/', swf, document.location.href, url);

}

function getMagGB2009()
{
  var url = 'http://www.geschaeftsbericht2009.bayer.de';
  var urlcaller = 'http://www.bayer.de';
  getMag2010(url + '/de/flash.aspx', document.location.href, url + '/swf/magazin/', 'bayer_magazin_de.swf', document.location.href, url)
}

function getMagGB2009en()
{
  var url = 'http://www.annualreport2009.bayer.com';
  var urlcaller = 'http://www.bayer.com';
  getMag2010(url + '/en/flash.aspx', document.location.href, url + '/swf/magazin/', 'bayer_magazin_en.swf', document.location.href, url)
}


function getMag2010(url, skiplink, swfpath, swflink, closelink, gblink) {
	if (jQuery.browser.msie && (jQuery.browser.version < 6.9999) ){
		window.open(url,'Flash','location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=975,height=580');
		//return false;
	} else {
    $("body").css("overflow","hidden");
    $("body").append('<div id="divfixed"></div><div id="container"><div id="mag"><a href="http://www.adobe.com/go/getflashplayer" style="display:block; margin:250px 0 0 430px;" target="_blank"><img src="/img/system/get_flash_player.gif" alt="Get Adobe Flash player"></a></div></div>');

    var scrollTop= $(window).scrollTop();
    $("#container").css("top",scrollTop+"px");


    jQuery("#divfixed").click(function () { 
      jQuery(this).remove();
      jQuery("#container").remove();
      jQuery("body").css({ overflow:"auto" });
    });

    swfobject.embedSWF(swfpath + swflink, "mag", "975", "580", "8.0.0","/swf/expressInstall.swf", {skipLink:skiplink,swflink:swfpath, closelink:closelink, gblink:gblink}, {wmode:"transparent",allowscriptaccess:"always"});

	}
}

function getTroja(url, skiplink, swfpath, swflink, closelink, gblink) {
	if (jQuery.browser.msie && (jQuery.browser.version < 6.9999) ){
		window.open(url,'Flash','location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=590,height=570');
		//return false;
	} else {
    $("body").css("overflow","hidden");
    $("body").append('<div id="divfixed"></div><div id="container"><div id="mag"><a href="http://www.adobe.com/go/getflashplayer" style="display:block; margin:250px 0 0 430px;" target="_blank"><img src="/img/system/get_flash_player.gif" alt="Get Adobe Flash player"></a></div></div>');

    var scrollTop= $(window).scrollTop();
    $("#container").css("top",scrollTop+"px");


    jQuery("#divfixed").click(function () { 
      jQuery(this).remove();
      jQuery("#container").remove();
      jQuery("body").css({ overflow:"auto" });
    });

    swfobject.embedSWF(swfpath + swflink, "mag", "590", "570", "8.0.0","/swf/expressInstall.swf", {skipLink:skiplink,swflink:swfpath, closelink:closelink, gblink:gblink}, {wmode:"transparent",allowscriptaccess:"always"});

	}
}
function getMagazin(domain, url, swf, rootpath, closeurl) {
	
	alternateurl = domain + url;
	swflnk = domain + swf;
	swfpath = domain + rootpath;
	//closelink = closeurl;
	closelink = document.location.href;
	
	
	if (jQuery.browser.msie && (jQuery.browser.version < 6.9999) ){
		window.open(alternateurl,'Flash','location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=975,height=580');
	} else {
		$("body").css("overflow","hidden");
		$("body").append('<div id="divfixed"></div><div id="container"><div id="mag"><a href="http://www.adobe.com/go/getflashplayer" style="display:block; margin:250px 0 0 430px;" target="_blank"><img src="/img/system/get_flash_player.gif" alt="Get Adobe Flash player"></a></div></div>');
		
		var scrollTop= $(window).scrollTop();
		$("#container").css("top",scrollTop+"px");
		
		jQuery("#divfixed").click(function () { 
			jQuery(this).remove();
			jQuery("#container").remove();
			jQuery("body").css({ overflow:"auto" });
		});
		
		swfobject.embedSWF(swflnk, "mag", "975", "580", "8.0.0","/swf/expressInstall.swf", {closelink:closelink, swflink:swfpath}, {wmode:"opaque",allowscriptaccess:"always", bgcolor:"#00284E"});

	}
}




	function zoomVideo(zoom, smallvideo, bigvideo, preview) {
		
		if(zoom == 'zoom'){
      jQuery("#language").width("57em");
      jQuery("#flashvideo").width("57em");
		
			var Width = 570;
			var Height = 341;
			var flashvars = {
				file:bigvideo,
				image:preview,
				width:Width,
				height:Height,
				clickTag:"javascript:zoomVideo('unzoom','"+ smallvideo+"', '"+bigvideo+"', '"+preview+"');",
				iszoomed:"true",
				autostart:"true",
				showzoom:"true"
			};

if(document.getElementById("specialgallery")){
    document.getElementById("divimagebox_1" ).className = "imgbox zoomed";
    intStatus1 = 1;
    document.getElementById("gallerytext").style.width = '570px';
}
		}
		if(zoom == 'zoomdontplay'){
      jQuery("#flashvideo").width("57em");
		
			var Width = 570;
			var Height = 341;
			var flashvars = {
				file:bigvideo,
				image:preview,
				width:Width,
				height:Height,
				clickTag:"javascript:zoomVideo('unzoom','"+ smallvideo+"', '"+bigvideo+"', '"+preview+"');",
				iszoomed:"true",
				autostart:"false",
				showzoom:"true"
			};

if(document.getElementById("specialgallery")){
    document.getElementById("divimagebox_1" ).className = "imgbox zoomed";
    intStatus1 = 1;
    document.getElementById("gallerytext").style.width = '570px';
}
		}
		if(zoom == 'unzoom'){
			
			
      jQuery("#language").width("27.8em");
      jQuery("#flashvideo").width("27.8em");
		
			var Width = 278;
			var Height = 178;
			var flashvars = {
				file:smallvideo,
				image:preview,
				width:Width,
				height:Height,
				clickTag:"javascript:zoomVideo('zoom','"+ smallvideo+"', '"+bigvideo+"', '"+preview+"');",
				iszoomed:"v",
				autostart:"false",
				showzoom:"true"
			};

if(document.getElementById("specialgallery")){
    document.getElementById("divimagebox_1" ).className = "imgbox";
    intStatus1 = 0;
    document.getElementById("gallerytext").style.width = '276px';
}		
		}


			
			var params = {
				//bgcolor : "#ffffff",
				wmode : "transparent",
				allowfullscreen : "true"
			};
			var attributes = {};
			
			swfobject.embedSWF("/swf/flvplayer.swf", "v1", Width, Height, "9.0.0", "expressInstall.swf", flashvars, params, attributes);
	}

function zoomVideo2(zoom, smallvideo, bigvideo, preview) {
		if(zoom == 'zoom'){
      jQuery("#flashvideo2").width("57em");
		
			var Width = 570;
			var Height = 341;
			var flashvars = {
				file:bigvideo,
				image:preview,
				width:Width,
				height:Height,
				clickTag:"javascript:zoomVideo2('unzoom','"+ smallvideo+"', '"+bigvideo+"', '"+preview+"');",
				iszoomed:"true",
				autostart:"true",
				showzoom:"true"
			};
		}
		if(zoom == 'unzoom'){
      jQuery("#flashvideo2").width("27.8em");
		
			var Width = 278;
			var Height = 178;
			var flashvars = {
				file:smallvideo,
				image:preview,
				width:Width,
				height:Height,
				clickTag:"javascript:zoomVideo2('zoom','"+ smallvideo+"', '"+bigvideo+"', '"+preview+"');",
				iszoomed:"false",
				autostart:"false",
				showzoom:"true"
			};
		}
			var params = {
				wmode : "transparent",
				allowfullscreen : "true"
			};
			var attributes = {};
			
			swfobject.embedSWF("/swf/flvplayer.swf", "v2", Width, Height, "9.0.0", "expressInstall.swf", flashvars, params, attributes);
}

$(document).ready(function() {
var timg = $(".DetailPictureLayer img");
var tspan = $("table.floating td.caption span.caption");
var ftable = $(".DetailPictureLayer");

if (parseInt(timg.height()) > parseInt(timg.width())) {
  timg.css("width","13.2em").css("height","19.9em");
  tspan.css("width","149px");
} else {
  ftable.css("width", "21.33em").css("margin-right","0");
  timg.css("width","19.9em").css("height","13.2em");
}
});

jQuery(function(){
  $.each( $(".imgtabbg"), function(i, n){
  $(n).hide();
   var imgtabbg = $(n).children("img").attr("src");
  $(n).parent(".plaintext").parent(".supertab").css("background", "#edfbec url("+imgtabbg+") no-repeat 0 0");
  $(".supertab .plaintext .indented").css("position","relative");
  });
  /*$(".supertab img[src='/img/system/linkarrow.gif']").remove();*/
  $(".supertab .indented a").addClass("lnk").css("font-size","100%");
});

