$(document).ready(function(){
	
	/* PNGFIX start *******************************************************************/
		$(document).pngFix();
	/* PNGFIX end *********************************************************************/
	
	/* EXTERNAL LINKS start ***********************************************************/
	$('a[@rel$="external"]').click(function(){
		this.target = "_blank";
	});	
	/* EXTERNAL LINKS end *************************************************************/

	/*SEARCH*/
	$('#search input.text').focus(function(){	if(this.value=='Search') {	$(this).val('');} });
	$('#search input.text').blur(function(){ if(this.value =='') {	$(this).val('Search');}	});
	/*SEARCH*/
	
	/* NAVIGATION start ***************************************************************/
	$('#nav ul ul').hide();
	//hover show 2nd level
	$('#nav ul > li').hover(function() { $('ul:first', this).show(); },function() {$('ul:first', this).hide();});
	/* NAVIGATION end ****************************************************************/
	
	/* SIFR***************************************************************************/
	$('.sifr-goudy, h1.title').flash(
		{ src: '/includes/media/font-goudySans-lt-bt.swf' },
		 { version: 8 },
			function(htmlOptions) {
				htmlOptions.flashvars.css = '*%20%7B%20color%3A%23'+RGBstring($(this).css('color'))+'%7D';
				htmlOptions.flashvars.txt = this.innerHTML;
				this.innerHTML = '<div>'+this.innerHTML+'</div>';
				var $alt = $(this.firstChild);
				htmlOptions.width = $(this).width(); //$alt.width()
				htmlOptions.height = $(this).height(); //$alt.height()
				$alt.addClass('sifr-alt');
				$(this).addClass('sifr-text-alt').prepend($.fn.flash.transform(htmlOptions));						
			}
		);
	/* SIFR**************************************************************************/
	
	/* COMMERCE:img click replace****************************************************/	
	$('.prod-sub-img').click(function() {	$('.prod-image').html($(this).html());	 return false	});
	/*COMMERCE:img click replace****************************************************/
	
}); //close document.ready

/* sIFR RGB conversion function start **********************************************/
function RGBstring(str) {
	str1 = str.replace("#","");
	str2 = str1.replace("rgb(","");
	str2 = str2.replace(")","");
	str2 = str2.split(",");
	if(navigator.appName == "Microsoft Internet Explorer"){ return str1; }
	else { return toHex(str2[0])+toHex(str2[1])+toHex(str2[2]); }
}
function toHex(N) {
 if (N==null) return "01";
 N=parseInt(N); if (N==0 || isNaN(N)) return "00";
 N=Math.max(0,N); N=Math.min(N,255); N=Math.round(N);
 return "0123456789ABCDEF".charAt((N-N%16)/16)
      + "0123456789ABCDEF".charAt(N%16);
}
/* sIFR RGB conversion function end *************************************************/
