﻿//window.onload = function(){
//document.getElementById("container").style.display="none";
//}

$(document).ready(function(){

	showstartlayer();

	stripeTable();

$.each($("a"), function (i,n) {

var pattern = "http://dermatica-exclusiv2010.dev.oevermann.local";

if ($(n).attr("href") != undefined && $(n).attr("href").indexOf(pattern) != -1) {
 newHref = $(n).attr("href").substr(pattern.length,$(n).attr("href").length);
 $(n).attr("href", newHref)
}


});

initonAccordion();
});




/* ::: - - - - - initonAccordion Function - - - - - ::: */
function initonAccordion() {
	
  $.each( $("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");
    }
  });

  $(".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");
    } });
  });

}







/* ::: - - - - - Tabelle stripen (even/odd)- - - - - ::: */
function stripeTable() {
  $.each( $("table.striped"), function(i, n){
    var zaehl = 0;
    $.each( $(n).find('tr'), function(j, m){
     zaehl++;
     if ($(m).hasClass('headline')) {
       zaehl=0;
      }
      if(!(zaehl%2)){
             $(m).addClass("odd");
      }
    });
  });
}




function showstartlayer() {

 if ($.cookie('introCookie') != "introgo")
     {	
         $("#container").css("display", "none");

         $("body").append('<div id="shadowboxcopy_container">  <div id="shadowboxcopy_overlay"></div>  <div id="shadowboxcopy">    <div class="popup slideshow"> <img src="/img/startscreen/bild01.png" alt=""> <img src="/img/startscreen/bild02.png" alt=""> <img src="/img/startscreen/bild03.png" alt=""> </div>    <a class="popupclose"><img src="/img/startscreen/close.gif" alt=""></a> <a class="popupmore" href="http://www.dermatica-exclusiv.de/neues-verpackungsdesign.aspx"><img src="/img/system/transparent.gif" alt="" /></a> <div id="nav"></div></div></div>');

         $("#container").css("display", "block");
         $("#flash").css("display", "none");
         $("body#home #container").prepend('<div id="flash-temp"> <img src="/img/flash/flash01.jpg" alt="Dermatica Exclusiv"/></div>');
         $("body#home #flash-temp").css("display", "block");
	
	$("#shadowboxcopy_container").css("display", "block");
	$("#shadowboxcopy_overlay").click(function() { close(); });
	$(".popupclose").click(function() { close(); });
	
	$('.slideshow').cycle({ 
		fx:    'fade', 
		timeout:	5000,
		speed:  750,
                                           pager:  '#nav' 
	}); 

	$.cookie('introCookie', 'introgo', { expires: 1 });

helper();
//window.setTimeout("helper()", 1000);

    }
}

function helper() {
                     $("#nav a").html('<img src="/img/system/transparent.gif" alt="" />');
}

function close() {
	$("#shadowboxcopy_container").css("display", "none");
         $("body#home #flash-temp").css("display", "none");
         $("#flash-temp").remove();
         $("#flash").css("display", "block"); 
}



    function setHomepage()
    {
     if (document.all)
        {
            document.body.style.behavior='url(#default#homepage)';
      document.body.setHomePage('http://www.dermatica-exclusiv.de/');

        }
        else if (window.sidebar)
        {
        if(window.netscape)
        {
             try
       {  
                netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");  
             }  
             catch(e)  
             {  
        alert("this action was aviod by your browser,if you want to enable,please enter about:config in your address line,and change the value of signed.applets.codebase_principal_support to true");  
             }
        } 
        var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
        prefs.setCharPref('browser.startup.homepage','http://www.asp.net/130.aspx');
     }
    }

