//jQuery.noConflict();
jQuery(document).ready(function(){
	
	try{
	
	jQuery('#slideshow').innerfade({
		animationtype: 'fade',
		speed: 'normal',
		timeout: $('#timeInterval').val(),
		type: 'sequence',
		containerheight: '245',
		runningclass: 'innerfade'
	});
	
	jQuery('body').supersleight();
	
	if(typeof(backgroundImage) != 'undefined'){
    if (backgroundImage == '/Images/body_back.gif')
      $('#bodyBackground').attr({'src': backgroundImage});	
    else
      $('#bodyBackground').attr({'src': backgroundImage});	
	}
	
	
	$("a.minus").click(function(event){
          var _val = 0;
        
          if($("label:contains('Antal')").length != 0){
            _val = $($("label:contains('Antal')").siblings().children()[0]).val();
          }
          
          if($("label:contains('Quantity')").length != 0){
            _val = $($("label:contains('Quantity')").siblings().children()[0]).val();
          }
          
          if(_val != 0){
            var num = 0;
            if (document.mainform.content_0_form_52E07F0F81ED4BC2829A9082A1538948_field_C4D1ADF49B4647DE8F45B14A234E79D9_84AEB055BACF481BAEFA022B6AD2C0FD.value != ''){
               num = parseInt(document.mainform.content_0_form_52E07F0F81ED4BC2829A9082A1538948_field_C4D1ADF49B4647DE8F45B14A234E79D9_84AEB055BACF481BAEFA022B6AD2C0FD.value);
            }
            //if (num > 0){
            num = num - 1;
            document.mainform.content_0_form_52E07F0F81ED4BC2829A9082A1538948_field_C4D1ADF49B4647DE8F45B14A234E79D9_84AEB055BACF481BAEFA022B6AD2C0FD.value = num;
            //}
            event.preventDefault();
          }
          });
		  
	$("a.plus").click(function(event){
          var num = 0;
          if (document.mainform.content_0_form_52E07F0F81ED4BC2829A9082A1538948_field_C4D1ADF49B4647DE8F45B14A234E79D9_84AEB055BACF481BAEFA022B6AD2C0FD.value != ''){
            num = parseInt(document.mainform.content_0_form_52E07F0F81ED4BC2829A9082A1538948_field_C4D1ADF49B4647DE8F45B14A234E79D9_84AEB055BACF481BAEFA022B6AD2C0FD.value);
          }
          num = num + 1;
          document.mainform.content_0_form_52E07F0F81ED4BC2829A9082A1538948_field_C4D1ADF49B4647DE8F45B14A234E79D9_84AEB055BACF481BAEFA022B6AD2C0FD.value = num;
          event.preventDefault();
          });

	//append list of link to content area. Function located in \scripts\footnoteLinks.js
	footnoteLinks('content', 'content');

	jQuery('#functionality').prepend("<a href=\"JavaScript:window.print();\" class=\"printpage\">" + jQuery('#printPageLabel').val() + "</a>");
	

  if ($('#selectInputLinks').lenght != 0){
    $('#linksListOptions > li').each(function(){
      $(this).click(function(){
        var div = $(this).children()[1];
        var textVal = $(div).html();
        $('#selectValue').html(textVal);
        $("#linksListOptions").toggle();
        var input = $(this).children()[0];
        var redirectAddress = $(input).val();
        if (redirectAddress != '')
          window.location = redirectAddress;
      });
    });
    
     $('#linksListOptions > li').mouseover(function(){
        $(this).addClass('linksListHover');
        $(this).css('color', 'white');
     });
      $('#linksListOptions > li').mouseout(function(){
        $(this).removeClass('linksListHover');
        $(this).css('color', 'black');
     });
	
      
      var leftColumn = $('#leftColumn').children()[0];
      $(leftColumn).css('z-index', '100');
	}
	
	}
	catch(Exception){
	}
	
	
});
		
function handleCustomSelectArrowClick(){
  $("#linksListOptions").toggle();
}

jQuery(function($) {
  
	// Lines
	$('#mainMenu, #leftFooter, #rightFooter, .leftBox, #subMenu, .temaBox, #formularTitle').prepend('<div class="leftShort"></div>').append('<div class="leftShort" style="_margin-top: -1px;"></div>');
	$('#content .bookForm .scfSectionBorder').prepend('<div class="leftMedium"></div>').append('<div class="leftMedium"></div>');
	
	$('#pageOptions').prepend('<div class="rightShort"></div>').append('<div class="rightShort"></div>');
	//$('#lang').prepend('<div class="rightShort"></div>').append('<div class="rightShort"></div>');
	$('#introText, #subPageTitle').prepend('<div class="leftShort"></div>');
	$('#moreNews').prepend('<div class="leftLong"></div>');
	//temabox zebra
	$('#temaBoxes .temaBox:even').css({"paddding-right":"0"});
	
	// slideshow hover
	$('#slideshow, .leftBox, .latestNews').hover(
	  function () {
		$(this).addClass("hovered");
	  }, 
	  function () {
		$(this).removeClass("hovered");
	  }
	);
	// box links height
	$('.leftBox').each(function(){
		var leftBoxHeight = $(this).height();
		$(this).find('a.leftLink').css({"height": leftBoxHeight})
	});
	
	$('.latestNews').each(function(){
		var latestBoxHeight = $(this).height();
		$(this).find('a.latestNewsLink').css({"height": latestBoxHeight})
	});	
	
  if ($('.scfForm').children().length < 3){
    $("#productNumber").css({'display': 'none'});
  }else{
    if($("label:contains('Antal')").length != 0){
      $($("label:contains('Antal')").siblings().children()[0]).css({'width':'30px', 'text-align': 'right'})
      $($("label:contains('Antal')").siblings()).append($("#productNumber")).css({'height':'35px', 'width': '100px'});
    }
    
    if($("label:contains('Quantity')").length != 0){
      $($("label:contains('Quantity')").siblings().children()[0]).css({'width':'30px', 'text-align': 'right'})
      $($("label:contains('Quantity')").siblings()).append($("#productNumber")).css({'height':'35px', 'width': '100px'});
    }
	}
		
	//$('.slideshowText span').supersleight();
		
});




