
$(document).ready(function(){

	var isMSIE6 = $.browser.msie && /MSIE 6\.0/i.test(window.navigator.userAgent) && !/MSIE 7\.0/i.test(window.navigator.userAgent);
	
	/*remove text on search input text on top page*/	
	$("#searcherField").focus(function(){
	if(this.value=='Search by keyword or catalogue no.')
		{
		this.value=''
		}
	});

	/* remove text on search text input on inspiration detail page*/
	$(".inputBox").focus(function(){
	if(this.value=='Postcode or city')
		{
		this.value=''
		}
	});

	/* css properties for transparency 
	$('#categoryMenu li ul').css({'filter':'alpha(opacity=85)', '-moz-opacity':'0.85', 'opacity':'0.85'});
	*/
	/**/
	if ( isMSIE6 ) {
		jQuery("#categoryMenu>li").hover(
			function() {
				var position = jQuery(this).position();
				
				jQuery(">h2>a", this).addClass("hover");
				jQuery(".menuChild", this)
					.css({
						"display" : "block",
						"position" : "absolute"});
						
			},
			function() {
				jQuery(".menuChild", this).css({
						"display" : "none"});
				jQuery(">h2>a", this).removeClass("hover");
			}
		);
		
		jQuery(".com00002>ul>li").hover(
			function() {
				var position = jQuery(this).position();

				jQuery(">a", this).addClass("hover").css("background-position", "0 -30px");
				
				jQuery("ul", this)
					.css({
						"display" : "block",
						"position" : "absolute",
						"left" : position.left});
			},
			function() {
			    jQuery(this).children("ul").css("display", "none");
			    jQuery(">a", this).removeClass("hover").css("background-position", "0 0");
			}
		);
	}
   
	/*thickbox fix to avoid invalid validation*/
	$('a.thickbox, area.thickbox, input.thickbox, a.loginLink').click(function(){
		
		$('.TB_overlayBG').css({'filter':'alpha(opacity=80)', '-moz-opacity':'0.80', 'opacity':'0.80'});    // lines 41  - 43
		$('#TB_HideSelect').css({'filter':'alpha(opacity=0)', '-moz-opacity':'0', 'opacity':'0'});          // lines 154 - 156
		$('#TB_iframeContent').css({'_margin-bottom':'1px'}); // line  175
		//make rounded corner for webkit and gecko
		$('#productTBStationery').css({'-moz-border-radius':'10px', '-webkit-border-radius':'10px'});
		
		var isMSIE6 = $.browser.msie && /MSIE 6\.0/i.test(window.navigator.userAgent) && !/MSIE 7\.0/i.test(window.navigator.userAgent);
		// IE 6 hacks
		if (isMSIE6) {
			var Height_0 = document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'
			$('#TB_overlay').css({'height':Height_0});                                                     // line  50
			
			var MarginTop_0 = 0 - parseInt($("#TB_window").height() / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px';
			//this is to fix calculation for shop img preview
			$('#TB_window').css({'margin-top':MarginTop_0});                                               // line  69

			
			
			
      
			
			var MarginTop_1 = 0 - parseInt($('#TB_load').height() / 2) + (TBWindowMargin = document.documentElement && document.documentElement.scrollTop || document.body.scrollTop) + 'px';
			$('#TB_load').css({'margin-top':MarginTop_1});                                                 // line  142
			
			var Height_1 = document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px';
			$('#TB_HideSelect').css({'height':Height_1});                                                  // line  165
		}
		
		if (!isMSIE6) {
			// $("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
		}
		$("#TB_overlay").click(tb_remove);
		return false;
	});
	//this line to append span for rounded corner on images, img must has imgwrapper class
	var isMSIE6 = $.browser.msie && /MSIE 6\.0/i.test(window.navigator.userAgent) && !/MSIE 7\.0/i.test(window.navigator.userAgent);
	for(i=1;i<=4;i++) $(".imgwrapper").append('<span class="curve'+ i +'"></span>');
	for(i=1;i<=4;i++) $(".imgwrapper-yellow").append('<span class="curve-yellow'+ i +'"></span>');
	
	//this is will remove nasty border in ie6 only when height attibute 203

	var heightAttr = $(".imgwrapper img").attr("height");
	var widthAttr = $(".imgwrapper img").attr("width");
	if (isMSIE6 && heightAttr == 203 ) {
		$(".imgwrapper img").css("height", heightAttr - 1);
		$(".imgwrapper img").css("width", widthAttr - 1);		
	}
	
		
	
});
$(document).ready(function(){
	thickboxJavascriptQueryString('a.thickboxJavascriptQueryString', "Processing...");//pass where to apply thickbox
	imgLoader = new Image();// preload image
	imgLoader.src = tb_pathToImage;
});
function thickboxJavascriptQueryString(domChunk, exitLoaderCaption){
	$(domChunk).click(function(){
		//var newHref = "/loginJavascript.htm?height=293&width=310&modal=true&javascript=true";
		var currentHref = $(this).attr("href");
		if(currentHref != undefined && currentHref != ""){
			if(currentHref.indexOf("?") != -1){
				currentHref = currentHref + "&javascript=true";
			} else {
				currentHref = currentHref + "?javascript=true";
			}
		}
		var g = this.rel || false;
		tb_show("Confetti Login",currentHref,g, exitLoaderCaption);
		
		$('.TB_overlayBG').css({'filter':'alpha(opacity=50)', '-moz-opacity':'0.50', 'opacity':'0.50'});
		$('#TB_HideSelect').css({'filter':'alpha(opacity=0)', '-moz-opacity':'0', 'opacity':'0'});  
		
		$('.TB_overlayBG').click(tb_remove);
		this.blur();
		return false;
	});
}
// function for popup if add shopping button clicked, this message will appear
function showBasketPopup(showPopup) {
	if (showPopup==true) {
		$('#confirmationAdded').fadeIn('fast');
		$('#confContShop').click(function(){
			$("#confirmationAdded").hide('fast'); 
			return false;
		});

		setTimeout(function(){ 
			$("#confirmationAdded").fadeOut('fast'); 
		}, 6000);

	}
}

