
function clearOnFocus(elementId){
	var x = document.getElementById(elementId);
	var xstring = x.value;var ystring = "";
	x.value = xstring;x.onfocus = function(){if(this.value == xstring) {this.value = ystring;}};
	x.onblur = function(){if(this.value == ystring) {this.value = xstring;}};
}

var msie = false; if(String(navigator.userAgent).indexOf("MSIE")>-1){msie=true;}

$(document).ready(function(){
	$('a._blank').click(function(){window.open(this.href); return false;});


	$('.clearOnFocus').each(function()	{
		var x = '';
		if($(this).val()==''){
			x = $(this).attr('title');
			$(this).val(x);
		}
	});

	$('.clearOnFocus').focus(function(){
		if($(this).val()==$(this).attr('title')){
			$(this).val('');
		}
	});
	
	$('.clearOnFocus').blur(function()	{
		var x = '';
		if($(this).val()==''){
			x = $(this).attr('title');
			$(this).val(x);
		}
	});

	$('.datepick').datepicker({inline: true, dateFormat: 'dd/mm/yy'});
	$('.timepick').timepicker({inline: true, timeFormat: 'h:mm'});
	$('.datetimepick').datetimepicker({inline: true, dateFormat: 'dd/mm/yy', timeFormat: 'h:mm'});

	$("a.youtube").colorbox({iframe:true, innerWidth:425, innerHeight:344});
	$("a.iframe").colorbox({iframe:true, innerWidth:"80%", innerHeight:"80%"});
	$('a[rel*=lightbox]').colorbox({transition:"fade",slideshow:true,slideshowAuto:false,slideshowSpeed:4000,innerWidth:"80%", innerHeight:"80%"});
	if(screen.colorDepth<=8){
		$('body').addClass('lowcolor');
	}
	
	if(parseInt($("#sidebar #cart_summary.autoshow span.simpleCart_quantity").html())==0){
		$("#sidebar #cart_summary.autoshow").hide(0);
	}
	$('.simpleCart_shelfItem a.item_add').click(function(){
		setTimeout('if(parseInt($("span.simpleCart_quantity").html())>0){$("#sidebar #cart_summary.autoshow").slideDown(750);}',10);
	});
	$('.itemRemove>a').click(function(){
		setTimeout('if(parseInt($("span.simpleCart_quantity").html())==0){$("#sidebar #cart_summary.autoshow").delay(750).slideUp(750);}',10);
	});
	$('.itemdecrement>a').click(function(){
		setTimeout('if(parseInt($("span.simpleCart_quantity").html())==0){$("#sidebar #cart_summary.autoshow").delay(750).slideUp(750);}',10);
	});
	$('a.simpleCart_empty').click(function() {
		$("#sidebar #cart_summary.autoshow").delay(750).slideUp(750);
	});
});

