Cufon.set('letterSpacing', 'normal');
Cufon.set('fontSize', '16px');
Cufon.replace("DIV.search LABEL", { hover:true });
Cufon.replace("DIV.navigation LI", { hover:true });
Cufon.replace("DIV.sidebar LI", { hover:true });
Cufon.replace("UL.menu LI", { hover:true });
Cufon.replace("h1.title", {fontSize:'28px'});
Cufon.replace("h1.sub-title", {fontSize:'23px'});
Cufon.replace("h1.type-title", {fontSize:'28px'});
Cufon.replace("h2:not(.node-title),h3", {fontSize:'19px'});
Cufon.replace('DIV.no-selection', {fontSize:'28px'});
Cufon.replace("BODY.section-cart DIV#progress-tracker", { hover:true });
Cufon.replace("#language A", {fontSize:'14px',hover:true}); 
Cufon.replace("#WebCodeTitle", {fontSize:'14px',hover:true}); 
/*Cufon.replace("A#hotline SPAN", {fontSize:'14px'});*/
Cufon
('BODY.page-product DIV.form-item A')
("DIV#login LABEL")
("DIV#login A")
('DIV.footer SPAN.wellcome-message SPAN.logout');
Cufon.replace("DIV.quickresult .submit A", { hover:true });
Cufon.replace("DIV.quicklook .options A", { hover:true, fontSize:'14px' });
Cufon.replace("DIV.quicklook .submit A", { hover:true, fontSize:'14px' });
Cufon.replace(".submit A", { hover:true, fontSize:'16px' });
Cufon.replace("BODY.section-location #location h2", {fontSize:'28px'});
Cufon.replace("BODY.section-location #location h3", {fontSize:'16px'});

Cufon.replace('BODY.page-product DIV.bubble-inner STRONG', {fontSize:'14px'});
Cufon.replace(".node-title", {fontSize:'19px'});

/* info */
Cufon.replace("body.page-tt-news-single .node-title", {fontSize:'28px'});
Cufon.replace("body.page-info-single .node-title", {fontSize:'28px'});
Cufon.replace("body.page-info-single .node-content h3", {fontSize:'28px'});
Cufon.replace("body.page-info-single .node-content h4", {fontSize:'16px'});
/* end info */

function make_sitestat($obj,sAttr,sType) {
	if ($obj.hasClass('ss_performed'))
		return true;
	$obj.addClass('ss_performed')
	var sHref=$obj.attr('href');
	if(sHref.substr(0,1) == "/")
		sHref = "http://www.goin.de" + sHref;
	var newHREF="http://de.sitestat.com/goin/goin/s?";
	newHREF += sAttr  + "&amp;ns_type=" + sType + "&ns_url=" + sHref ;
	$obj.attr('href',newHREF);
	return true;
}

(function($) {
	var map=new Array();
/*	$.Watermark = {
		ShowAll:function(){
			for (var i=0;i<map.length;i++){
				if(map[i].obj.val()==""){
					map[i].obj.val(map[i].text);					
					map[i].obj.css("color",map[i].WatermarkColor);
				}else{
				    map[i].obj.css("color",map[i].DefaultColor);
				}
			}
		},
		HideAll:function(){
			for (var i=0;i<map.length;i++){
				if(map[i].obj.val()==map[i].text)
					map[i].obj.val("");					
			}
		}
	}
*/	
	$.fn.Watermark = function(text,color) {
		if(!color)
			color="#aaa";
		return this.each(
			function(){		
				var input=$(this);
				var defaultColor=input.css("color");
				map[map.length]={text:text,obj:input,DefaultColor:defaultColor,WatermarkColor:color};
				function clearMessage(){
					if(input.val()==text)
						input.val("");
					input.css("color",defaultColor);
				}

				function insertMessage(){
					if (input.parents('div').parents('div').hasClass('focus')) {
						
					}else{
						if(input.val().length==0 || input.val()==text){
							input.val(text);
							input.css("color",color);	
						}else
							input.css("color",defaultColor);
					}
				}


 				input.focus(clearMessage);
				input.blur(insertMessage);								
				input.change(insertMessage);
				
				insertMessage();
			}
		);
	};
})(jQuery);

$(document).ready(function() {
	$("body").addClass("js");
	$(".slideshow").each(function(){
		$(this).cycle(
				{fx: 'fade', 
				 slideExpr: 'a img,img', 
				 timeout: $(this).attr("ref") * 1000}
		);
		
	});
	$("#FooterPrint").click(function() {
		window.print();
	});
	$('SPAN.debug A').click(function(e) {
		$.get(this.href, function(data){
			$('BODY').append(data);
		});
		return false;
	});
	// Der Presselinks werden über Sitestat geroutet
	$('div.node div.links a').click(function(event) {
		if ($.goin.isDev()) return true;
		var sAttr=$(this).parents('div.links').attr('id');
		if(sAttr == '' || sAttr == undefined)
			return false;
		sAttr = sAttr + "." + $(this).html().toLowerCase();
		return make_sitestat($(this),"download.press." + sAttr,'pdf');
	});
	// Der download link ist fuer sitestat pdf zaehler
	$('a.download').click(function(event) {
		if ($.goin.isDev()) return true;
		$(this).attr('target','_blank');
		var sAttr=$(this).attr('sitestat').toLowerCase();
		if(sAttr == '' || sAttr == undefined)
			return false;
		return make_sitestat($(this),sAttr,'pdf')
  });
  // Der external-link-new-window link ist fuer sitestat clickout zaehler 
  $('a.external-link-new-window').click(function(event) {
		if ($.goin.isDev()) return true;
		$(this).attr('target','_blank');
		var sAttr =$(this).attr('sitestat').toLowerCase();
		if(sAttr == '' || sAttr == undefined)
			return false;
		return make_sitestat($(this),sAttr,'clickout');
  });
	
	if (jQuery.isFunction(jQuery.fn.tooltip)) {
		$('body.page-all .product-matrix ul li a').tooltip({format:true});
		$("body.page-material .bubble-thumbs ul li a").tooltip();
		$("body.page-search .product-matrix ul li a").tooltip();
		$("body.page-property .product-matrix ul li a").tooltip();
		$('body.page-collection #browser.bubble-collection LI A').imgtip();
	}
//WH 0812.20 nur noch auf der ShopSeite
//	// die warenkorb menge muss auf jeder Seite abgefragt werden
//	if (jQuery.basket != null)
//		$.basket.init();
	$('.node .links dt').toggle(function(){
		$(this).find("img").attr('src','/fileadmin/templates/goin/assets/images/arrow-up.png');
		$('dd').show();
	},function() {
		$(this).find("img").attr('src','/fileadmin/templates/goin/assets/images/arrow-down.png');
		$('dd').hide();
	});
	$('#block-menu-katalog-links .menu LI').hover(
		function(){$(this).addClass('hover')},
		function(){$(this).removeClass('hover')
	});
	$('div.GoogleMap').each(function() {
		if (GBrowserIsCompatible()) {
	    $(this).height('500px');    
	    $(this).width('100%');    
			koordinaten=$(this).attr('title');
			var description=$(this).find("SPAN").html();
			var aKoord=koordinaten.split(',');
			
		  var map = new GMap2(this);
		  
		  map.enableScrollWheelZoom();
		  map.setCenter(new GLatLng(aKoord[0],aKoord[1]), 13);
		  map.addControl(new GSmallMapControl());
		  map.addControl(new GMapTypeControl());
	    var marker = new GMarker(map.getCenter());
	    GEvent.addListener(marker, "click", function() {
	      marker.openInfoWindowHtml(description);
	    });
	    map.addOverlay(marker);
	    marker.openInfoWindowHtml(description);
    }
	});
	$("#edit-search").Watermark($("#edit-search").attr("ref"));
});


