//tabbed interface for service
(function($) { //* hide the namespace
$(document).ready(function() {	
						   
  //Get all the LI from the #tabMenu UL
  $('#tabMenu > li').click(function(){
        
    //remove the selected class from all LI    
    $('#tabMenu > li').removeClass('selected');
    
    //Reassign the LI
    $(this).addClass('selected');
    
    //Hide all the DIV in .boxBody
    $('.boxBody div').slideUp('1500');
    
    //Look for the right DIV in boxBody according to the Navigation UL index, therefore, the arrangement is very important.
    $('.boxBody div:eq(' + $('#tabMenu > li').index(this) + ')').slideDown('1500');
    
  }).mouseover(function() {

    //Add and remove class, Personally I dont think this is the right way to do it, anyone please suggest    
    $(this).addClass('mouse_over');
    $(this).removeClass('mouse_out');   
    
  }).mouseout(function() {
    
    //Add and remove class
    $(this).addClass('mouse_out');
    $(this).removeClass('mouse_over');    
    
  });

  //Mouseover with animate Effect for Category menu list
/*  $('.boxBody #category li').mouseover(function() {

    //Change background color and animate the padding
    $(this).css('backgroundColor','#888');
    $(this).children().animate({paddingLeft:"20px"}, {queue:false, duration:300});
  }).mouseout(function() {
    
    //Change background color and animate the padding
    $(this).css('backgroundColor','');
    $(this).children().animate({paddingLeft:"0"}, {queue:false, duration:300});
  });  */
	
  //Mouseover effect for Posts, Comments, Famous Posts and Random Posts menu list.
/*  $('.boxBody li').click(function(){
    window.location = $(this).find("a").attr("href");
  }).mouseover(function() {
    $(this).css('backgroundColor','#888');
  }).mouseout(function() {
    $(this).css('backgroundColor','');
  });  */	
	
});
})(jQuery); //* hide the namespace
//auto fill for product category, subcategory and category number
var sub_category_options=new Array()
var category_id_value=new Array()

sub_category_options[0] = new Array("")
sub_category_options[1] = new Array("")
sub_category_options[2] = new Array("")
sub_category_options[3] = new Array("")
sub_category_options[4] = new Array("")


category_id_value[0] = new Array("0")
category_id_value[1] = new Array("1")
category_id_value[2] = new Array("2")
category_id_value[3] = new Array("3")
category_id_value[4] = new Array("4")

function init(){
form_name=document.forms["productForm"]
form_name.category.selectedIndex=0
fill_sub_category(0)
form_name.category_id.value = "0";
}

function fill_sub_category(oSelected) {
var selectedArray = window["sub_category_options"][oSelected];
while (selectedArray.length < form_name.sub_category.options.length) {
form_name.sub_category.options[(form_name.sub_category.options.length - 1)] = null;
}
for (var i=0; i < selectedArray.length; i++) {
form_name.sub_category.options[i]=new Option(selectedArray[i]);
form_name.category_id.value = category_id_value[form_name.category.selectedIndex];
}
}

//admin level alert 
var message="Upps...sorry about this. Maybe you don't have the necessary rights to perform this function. For further informations on this, please consult the head of admin.";
function noClick()
{
 alert(message)
}

//products links animation
$(document).ready(function(){
$(".flip").click(function(){
$(".panel").slideToggle("slow");
});
});

$(document).ready(function(){
$(".loadField0").click(function(){
$(".upload0").slideToggle("slow");
});
});
$(document).ready(function(){
$(".loadField1").click(function(){
$(".upload1").slideToggle("slow");
});
});
$(document).ready(function(){
$(".loadField2").click(function(){
$(".upload2").slideToggle("slow");
});
});
$(document).ready(function(){
$(".loadField3").click(function(){
$(".upload3").slideToggle("slow");
});
});
$(document).ready(function(){
$(".loadField4").click(function(){
$(".upload4").slideToggle("slow");
});
});
$(document).ready(function(){
$(".loadField5").click(function(){
$(".upload5").slideToggle("slow");
});
});
//close the login panel after user login
function closing(){
 document.forms['LoginForm'].elements['user_login'].value =""
 document.forms['LoginForm'].elements['password'].value = ""
  setTimeout("closing()",40000)
}

//show or hide a hidden div
function showHideMe(id){
   if(document.getElementById(id).style.display=="none"){
     document.getElementById(id).style.display="block"
   }
else{
   document.getElementById(id).style.display="none"
  }
}

//validation for login forms
function singleSubmit(formName,formField){
 if(document.forms[formName].elements[formField].value == "0"){
  document.forms[formName].elements[formField].value = "1";
  return true;
 } else {
  return false;
 }
}
function singleSubmitDisable(form, flagName, submitButtonName) {
 if (form.elements[flagName].value == "0") {
  form.elements[flagName].value = "1";
  form.elements[submitButtonName].disabled = true;
  return true;
 } else {
  return false;
 }
}
function openLayer(url, width, height) {
    thisUrl = url.indexOf("?") == -1 ? url+"?TB_iframe=true&width="+width+"&height="+height : url+"&TB_iframe=true&width="+width+"&height="+height;
    tb_show(null,thisUrl, false);
}    
$(document).ready(function() {
    if(typeof document.body.style.maxHeight === "undefined")
        $(".SubNav li, #quickdone li, #quickdone2 li").each(function() { 
        
            that = $(this);
            $(that).bind("mouseenter", function() {
                $(this).addClass("sfhover");
            });
            $(that).bind("mouseleave", function() {
                $(this).removeClass("sfhover");
            });
        });    
    
// the customer login properties
    var loginHtml = $("#rightLogin").html();
    $("#rightLogin").remove();
    $("#helpLogin").append("<div id='rightLogin' style='display:none;'>" + loginHtml + "</div>");
    if ($("span#KNRToolTip").length > 0 ) {
        $("span#KNRToolTip").tooltip({
            track: true,
            delay: 0,
            showURL: false,
            showBody: "|"
        });
    }
    if ($("span#PINToolTip").length > 0 ) {
        $("span#PINToolTip").tooltip({
            track: true,
            delay: 0,
            showURL: false,
            showBody: "|"
        });
    }
    
    $("body").bind("click", function() {$("#rightLogin").hide();check();});
    $("#rightLogin input[name='user_login'], #rightLogin input[name='password']").bind("click", function(e) {e.stopPropagation()});
    $(".kundenlogin a").bind("mouseenter",function() {
        $("#rightLogin").show();
    });    
});