function contentSlider(number){					
	var newSlide = '#s'+number;
	var aktSlide = '.slide.current';

	var navSlide = '#nav_s' + number;
	var aktNavSlide = 'li.current';
	
	$(aktSlide).fadeOut('slow', function(){
		$(aktSlide).removeClass('current');
		$(aktNavSlide).removeClass('current');
			
		$(newSlide).fadeIn('slow', function(){
			$(newSlide).addClass('current');
			$(navSlide).addClass('current');							
		});
	});	
}

Page = {
	init: function(){
		$('#s1 .slide').css('display','block');
		Cufon.replace('#mainnav li a', {fontFamily: 'Franklin ITC BQ Medium',hover: true});
		Cufon.replace('#header-div h3', {fontFamily: 'Franklin ITC BQ Demi'});
		Cufon.replace('.button', {fontFamily: 'Franklin ITC BQ Demi'});
		Cufon.replace('.discount', {fontFamily: 'Franklin ITC BQ Demi'});
		
		var button1 = $('#button1 span').height()/2;
		$('#button1 span').css('marginTop','-'+button1+'px');
		
		var button2 = $('#button2 span').height()/2;
		$('#button2 span').css('marginTop','-'+button1+'px');
		
		//Util.externalLinks();
		
		Page.initializeSubNav('#productnav');
		Gallery.init();
		//Window.onDomReady(function() {new DropdownMenu($())});
	},
	initializeSubNav: function(element)
	{
		$(element).each(function(){
			$(this).children().each(function(el)
			{
				if($(this).get(0).nodeName.toLowerCase() == 'li')
				{
					var el = $(this);
					$(this).children().each(function(el2)
					{
						if($(this).get(0).nodeName.toLowerCase() == 'ul')
						{
							var el2 = $(this);
							
							$(this).hide();

							$(el).hover(function()
							{
								$(el2).show();
							},
							function()
							{
								$(el2).hide();								
							});
							
							Page.initializeSubNav($(this));
						}
					});
				}
			});
		});
	
		return this;
	}
};
Util= {
	getWindowSize: function(){
		var xScroll, yScroll;
		if (window.innerHeight && window.scrollMaxY) {
			xScroll = window.innerWidth + window.scrollMaxX;
			yScroll = window.innerHeight + window.scrollMaxY;
		} else if (document.body.scrollHeight > document.body.offsetHeight) {
			xScroll = document.body.scrollWidth;
			yScroll = document.body.scrollHeight;
		} else if(document.body) { 
			xScroll = document.body.offsetWidth;
			yScroll = document.body.offsetHeight;
		}
		var windowWidth, windowHeight;
		if (self.innerHeight) {
			if(document.documentElement.clientWidth){
				windowWidth = document.documentElement.clientWidth;
			} else {
				windowWidth = self.innerWidth;
			}
			windowHeight = self.innerHeight;
		} else if (document.documentElement && document.documentElement.clientHeight) {
			windowWidth = document.documentElement.clientWidth;
			windowHeight = document.documentElement.clientHeight;
		} else if (document.body) {
			windowWidth = document.body.clientWidth;
			windowHeight = document.body.clientHeight;
		}
		if(yScroll < windowHeight) {
			pageHeight = windowHeight;
		} else {
			pageHeight = yScroll;
		}
		if(xScroll < windowWidth) {
			pageWidth = xScroll;
		} else {
			pageWidth = windowWidth;
		}
		var arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
		return arrayPageSize;
	},
	externalLinks: function(){
		 $("a").each(function(){
		 	if(		 	  
		 	   $(this).attr("href") != "" &&	
		 	   $(this).attr("href").indexOf(window.location.hostname) < 0 &&
			   $(this).attr("href").indexOf("http://") >= 0 	
			   ||  $(this).attr("rel") == "external"   
		 	 ){
		 		$(this).attr("target", "_blank");
		 	 }
		 });
	},
    validateForm: function(id) {    	
		var result= true;				
		$("#"+id + " input, #"+id + " textarea, #"+id + " input.checkbox, #"+id + " .select").each(function() {
			if($(this).attr("class") && $(this).attr("class").match("required")) {
			    $(this).val($(this).val().replace(/^\s+|\s+$/g, ""));
				var itemresult= Util.validate($(this).attr("id"));
				result= result && itemresult;
			}
		});		
		if(!result){
			$(".mandatory").addClass("error");
		}else{
			$(".mandatory").removeClass("error");
		}
		return result;		
	},
	validate: function(id) {
		var result= true;
		var obj= $("#"+id);		
		var commands= $("#"+id).attr("class").split(" ");
		for(var i=0; i<commands.length; i++) {
			var command= commands[i].replace(/[0-9]/g, "");			
			switch(command) {
				case("minlength"):
					var length= parseInt(commands[i].replace(/minlength/g, ""));
					result= result && (obj.val().length>=length);
					break;
				case("maxlength"):
					var length= parseInt(commands[i]);
					result= result && (obj.val().length<=length);
					break;
				case("email"):
					result = result && ( obj.get(0).value.match(/\S@\S.\S{2,}/)!=null );
					break;
				case("checkbox"):
					if( $("#"+id+":checked").length <= 0 ){
						result = result && false;
						$("#"+id).parent().children(".checkbox .info").addClass("error");
					}					
					break;
				case("select"):
					result = result && !( $("#"+id).val() == "---" );					
					break;
				default:
					result= result && (obj.val().length!=0);
					break;
			}
		}						
		if(!result) {
			obj.addClass("error");
		} else {
			obj.removeClass("error");			
		}
		return result;
	}
};


Gallery= {
	init: function(zoom) {
		$(".galleries .gallery").each(function() {
			var gallery= $(this).attr("id");
			$(".image", $(this)).click(function() {
				$('#' + zoom).attr("src", $(this).attr("id"));
				$('#' + zoom).attr("width", $(this).attr("width"));
				$('#' + zoom).attr("height", $(this).attr("height"));
			});
		});
	}
}

Store = 
{
	init: function(){
		$('.toform').click(function(){
			$('.contact_form_div').hide();
			$('#' + $(this).attr("name")).show(500);
		});
	}
};


Jobs = {
	init: function()
	{

		$('.more').click(function(){
					
			$('.job').find('#fulltext').hide(500);
			$('.job').find('.more').show();
			$('.job').find('.less').hide();
			
			$(this).hide();
			$(this).parent().find(".less").show();
			$(this).parent().find(".less").css("display", "block");
		
			$(this).parent().find('#fulltext').show(500);				
		});
		
		$('.less').click(function(){
			$(this).hide();
			$(this).parent().find(".more").show();
			
			$(this).parent().find('#fulltext').hide(500);
		});
	}
};


