(function($){
	$(function(){
	   if (location.href.match(/.*(\.de\/$)/) || $('.header-menu li:first').hasClass('selected')) {
	  //return ;
	 $.createLayer({width:'800px',height:'365px',zIndex:999999},function(){
	  var contId	= '#'+settings.id,closeId = '#' + settings.closeId,image  = '<a href="fileadmin/template/pdf/sobkowski_happy-mehrwert.pdf" onclick="$.removeLayer();" target="_blank"><img src="fileadmin/template/images/sobkowski_happy-mehrwert.jpg"/></a>';

	    $(contId).html(image);
	    //close btn styles
	    $(closeId).css({
		width:'16px',
		height:'16px',
		cursor:'pointer',
		background:'url(fileadmin/template/images/closeX.png) left top no-repeat'
               }).hover(function(){
                $(this).css({backgroundPosition:'left -16px'});
               },function(){
                  $(this).css({backgroundPosition:'left top'});
                  }).click(function(){
		    $.removeLayer();

		  });

	      });
          


	 }


 		//Default tt_news Category First Item CSS
		if (!$('.content-plugin .center-category li.selected').size()) {
		 $('.content-plugin .center-category li:first').addClass('selected');
		}
		//tt_news list margin CSS
		$('.content-plugin .center-category li').each(function(index){
				if(index % 5 == 3 ){
					$(this).prev().addClass('set-margin-left');
				} /*else if($('.content-plugin .center-category li').size() <= 4 && index % 4 == 2 ){
					$(this).addClass('set-margin-left');
				}*/
		});
		// Form Check
		if ($('#codeInput').val()==''){
					$('#codeInput').val('Sicherheitscode hier eintragen').focus(function(){
						$(this).val('');
						});
		}
		//$('#sideRightLink').find('h3,p').attr("onclick","popWin('http://www.sobkowski.de/fileadmin/template/pdf/sob.pdf','popWindow',1024,768,true);");

		/*
		$('#codeInput').bind({
			blur:function(){
				//if($(this).val()=='') {$(this).val('Sicherheitscode hier eintragen');}
			},
			focus:function(){
				if($(this).val()=='Sicherheitscode hier eintragen'){$(this).val('');}
			}}).val('Sicherheitscode hier eintragen');
*/
			//Form Error Message Layout
			var FormIdArr = new Array('#vorname','#nachname','#emailaddress','#ihre','#codeInput');
			if($('#mailform').size()) {
				for(var i=0;i<FormIdArr.length;i++){
					switch(FormIdArr[i]){
							case '#ihre': TextValue = 'Enter your Ihre Nachricht!'; break;
							case '#vorname': TextValue = 'Enter your Vorname!'; break;
							case '#nachname': TextValue = 'Enter your Nachname!'; break;
							case '#codeInput': TextValue = 'Enter your Anti-Spam-Code!'; break;
							case '#emailaddress': TextValue = 'E-mail address must be valid syntax!'; break;
					}
						if ($(FormIdArr[i]).val().indexOf(TextValue) != -1 && $(FormIdArr[i]).val()!=""){
									$(FormIdArr[i]).val(TextValue).addClass('font-red').focus(function(){
													$(this).val('').removeClass('font-red').unbind();
										});
						} else if(i==3 && $(FormIdArr[i]).html().indexOf(TextValue) != -1 && $(FormIdArr[i]).html()!=""){
								$(FormIdArr[i]).html(TextValue).addClass('font-red').focus(function(){
													$(this).html('').removeClass('font-red').unbind();
									});
						}
							//replace space
							$(FormIdArr[i]).val($(FormIdArr[i]).val().replace(/(^\s*)|(\s*$)/g,""));
				}
			}


						function ___getPageSize() {
						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){ // all but Explorer Mac
							xScroll = document.body.scrollWidth;
							yScroll = document.body.scrollHeight;
						} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
							xScroll = document.body.offsetWidth;
							yScroll = document.body.offsetHeight;
						}
						var windowWidth, windowHeight;
						if (self.innerHeight) {	// all except Explorer
							if(document.documentElement.clientWidth){
								windowWidth = document.documentElement.clientWidth;
							} else {
								windowWidth = self.innerWidth;
							}
							windowHeight = self.innerHeight;
						} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
							windowWidth = document.documentElement.clientWidth;
							windowHeight = document.documentElement.clientHeight;
						} else if (document.body) { // other Explorers
							windowWidth = document.body.clientWidth;
							windowHeight = document.body.clientHeight;
						}
						// for small pages with total height less then height of the viewport
						if(yScroll < windowHeight){
							pageHeight = windowHeight;
						} else {
							pageHeight = yScroll;
						}
						// for small pages with total width less then width of the viewport
						if(xScroll < windowWidth){
							pageWidth = xScroll;
						} else {
							pageWidth = windowWidth;
						}
						arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
						return arrayPageSize;
				};

	});
})(jQuery);


