$(document).ready(function() {
	/* PNG FIX */
	$("#top").pngfix({
		imageFixSrc : '/images/pixel.gif'
	});
	
	$("#logoWrapper img").pngfix({
		imageFixSrc : '/images/pixel.gif'
	});
	
	$("#middle").pngfix({
		imageFixSrc : '/images/pixel.gif',
		sizingMethod : 'scale'
	});
	
	$("#bottom").pngfix({
		imageFixSrc : '/images/pixel.gif'
	});
	
	$("#beautyTip").pngfix({
		imageFixSrc : '/images/pixel.gif'
	});
	
	$("#label img").pngfix({
		imageFixSrc : '/images/pixel.gif'
	});
	
	function getNextTip(ajx) {
	    $.ajax({
	      type: "POST",
	      cache: false,
	      dataType: 'json',
	      url: '/ajax/site-get-tip/',
	      data: {
	    		wt_id: $("div[id^='tip_']").attr("id").replace('tip_', '')
	      },
	      success: function(msg) {
	      	var json = msg;
	      		  	      	   	
	      	if (json) {	      		
	      		$("#beautyTip div").attr("id", "tip_"+ json.id);
	      		$("#tip_"+ json.id).children("h1").removeClass("sIFR-replaced");
	      		
	      		$("#tip_"+ json.id).children("p").html(json.desc);
	      		
	      		$("#beautyTip div h1").attr("id", "tip_h1_"+ json.id);
	      		
	      		$("#tip_h1_"+ json.id).html(json.name);
	      		
	      		sIFR.replace(DINBOLD, {
	      			selector: '#beautyTip h1',
	      			wmode: 'transparent',
	      			css: [
	      			      '.sIFR-root { font-size: 15px; color: #FFFFFF; text-transform: uppercase;}'
	      			      ],
	      			      forceSingleLine: true,
	      			      tuneHeight: -10,
	      			      offsetTop: -5
	      		});
	      	}
	      	
	      },
	      error: function (XMLHttpRequest, textStatus, errorThrown) {
	      	
	      }
	    });
	
//		return false;
	}
	
	sIFR.replace(DINBOLD, {
		selector: '#beautyTip span.link',
		wmode: 'transparent',
		css: [
		      '.sIFR-root { font-size: 14px; color: #FFFFFF; text-transform: uppercase;}',
		      'a {color: #FFFFFF; text-decoration: none;}',
		      'a:hover {color: #2f2f30; text-decoration: none;}'
		      ],
		      forceSingleLine: true,
		      tuneHeight: -8,
		      offsetTop: -5,
		      onRelease: function() { getNextTip(); }
	});
	
	
});
