$(document).ready(function(){

	$('.slideshow').cycle({timeout:3600});
	
	jQuery('#mycarousel').jcarousel({
    	wrap: 'circular'
    });
	
	$('.no-tax-panel').hide();
	$('.tax-btn').mouseenter(function(){
	  $('.no-tax-panel').slideDown('normal');	  
    }).mouseleave(function(){
	  $('.no-tax-panel').slideUp('normal');
	});
	
	//Placeholder text for header search and login
	$('.sign-up input[type=text],#SearchForm input[type=text]').focus(function(){ 
		if($(this).val() == $(this).attr('defaultValue'))
		{
		  $(this).val('');
		}
	});
	$('.sign-up input[type=text],#SearchForm input[type=text]').blur(function(){
		if($(this).val() == '')
		{
		  $(this).val($(this).attr('defaultValue'));
		} 
	});
	
	$('#blog-posts').rssfeed('http://blog.thebidetshop.com.au/feed', { limit: 2, content: false });
	
});

// LIVE CHAT SETTINGS                        
var ps74hdsid = "TQ5EXmBYZcdh";
// safe-standard@gecko.js

var ps74hdiso;
try {
	ps74hdiso = (opener != null) && (typeof(opener.name) != "unknown") && (opener.ps74hdwid != null);
} catch(e) {
	ps74hdiso = false;
}
if (ps74hdiso) {
	window.ps74hdwid = opener.ps74hdwid + 1;
	ps74hdsid = ps74hdsid + "_" + window.ps74hdwid;
} else {
	window.ps74hdwid = 1;
}
function ps74hdn() {
	return (new Date()).getTime();
}
var ps74hds = ps74hdn();
function ps74hdst(f, t) {
	if ((ps74hdn() - ps74hds) < 7200000) {
		return setTimeout(f, t * 1000);
	} else {
		return null;
	}
}
var ps74hdol = true;
function ps74hdow() {
	if (ps74hdol || (1 == 1)) {
		var pswo = "menubar=0,location=0,scrollbars=auto,resizable=1,status=0,width=500,height=460";
		var pswn = "pscw_" + ps74hdn();
		var url = "http://messenger.providesupport.com/messenger/thebidetshop.html?ps_s=" + ps74hdsid;
		if (false && !false) {
			window.open(url, pswn, pswo); 
		} else {
			var w = window.open("", pswn, pswo); 
			try {
				w.document.body.innerHTML += '<form id="pscf" action="http://messenger.providesupport.com/messenger/thebidetshop.html" method="post" target="' + pswn + '" style="display:none"><input type="hidden" name="ps_s" value="'+ps74hdsid+'"></form>';
				w.document.getElementById("pscf").submit();
			} catch (e) {
				w.location.href = url;
			}
		}
	} else if (1 == 2) {
		document.location = "http\u003a\u002f\u002f";
	}
}
var ps74hdil;
var ps74hdit;
function ps74hdpi() {
	var il;
	if (3 == 2) {
		il = window.pageXOffset + 50;
	} else if (3 == 3) {
		il = (window.innerWidth * 50 / 100) + window.pageXOffset;
	} else {
		il = 50;
	}
	il -= (286 / 2);
	var it;
	if (3 == 2) {
		it = window.pageYOffset + 50;
	} else if (3 == 3) {
		it = (window.innerHeight * 50 / 100) + window.pageYOffset;
	} else {
		it = 50;
	}
	it -= (220 / 2);
	if ((il != ps74hdil) || (it != ps74hdit)) {
		ps74hdil = il;
		ps74hdit = it;
		var d = document.getElementById('ci74hd');
		if (d != null) {
			d.style.left  = Math.round(ps74hdil) + "px";
			d.style.top  = Math.round(ps74hdit) + "px";
		}
	}
	setTimeout("ps74hdpi()", 100);
}
var ps74hdlc = 0;
function ps74hdsi() {
	window.onscroll = ps74hdpi;
	window.onresize = ps74hdpi;
	ps74hdpi();
	ps74hdlc = 0;
	var url = "http://messenger.providesupport.com/invitation/thebidetshop.html?ps_s=" + ps74hdsid + "";
	var d = document.getElementById('ci74hd');
	if (d != null) {
		d.innerHTML = '<iframe allowtransparency="true" style="background:transparent;width=286;height=220" src="' + url + '" onload="ps74hdld()" frameborder="no" width="286" height="220" scrolling="no"></iframe>';
	}
}
function ps74hdld() {
	if (ps74hdlc == 1) {
		var d = document.getElementById('ci74hd');
		if (d != null) {
			d.innerHTML = "";
		}
	}
	ps74hdlc++;
}
if (false) {
	ps74hdsi();
}
var ps74hdd = document.getElementById('sc74hd');
if (ps74hdd != null) {
	if (ps74hdol || (1 == 1) || (1 == 2)) {
		if (false) {
			ps74hdd.innerHTML = '<table style="display:inline" cellspacing="0" cellpadding="0" border="0"><tr><td align="center"><a href="#" onclick="ps74hdow(); return false;"><img name="ps74hdimage" src="http://image.providesupport.com/image/thebidetshop/online-320783407.gif" width="153" height="67" border="0"></a></td></tr><tr><td align="center"><a href="http://www.providesupport.com/pb/thebidetshop" target="_blank"><img src="http://image.providesupport.com/lcbps.gif" width="140" height="17" border="0"></a></td></tr></table>';
		} else {
			ps74hdd.innerHTML = '<a href="#" onclick="ps74hdow(); return false;"><img name="ps74hdimage" src="http://image.providesupport.com/image/thebidetshop/online-320783407.gif" width="153" height="67" border="0"></a>';
		}
	} else {
		ps74hdd.innerHTML = '';
	}
}
var ps74hdop = false;
function ps74hdco() {
	var w1 = ps74hdci.width - 1;
	ps74hdol = (w1 & 1) != 0;
	ps74hdsb(ps74hdol ? "http://image.providesupport.com/image/thebidetshop/online-320783407.gif" : "http://image.providesupport.com/image/thebidetshop/offline-1227505679.gif");
	ps74hdscf((w1 & 2) != 0);
	var h = ps74hdci.height;
	if (h != 2) {
		ps74hdop = false;
	} else if ((h == 2) && (!ps74hdop)) {
		ps74hdop = true;
		ps74hdsi();
	}
}
var ps74hdci = new Image();
ps74hdci.onload = ps74hdco;
var ps74hdpm = false;
var ps74hdcp = ps74hdpm ? 30 : 60;
var ps74hdct = null;
function ps74hdscf(p) {
	if (ps74hdpm != p) {
		ps74hdpm = p;
		ps74hdcp = ps74hdpm ? 30 : 60;
		if (ps74hdct != null) {
			clearTimeout(ps74hdct);
			ps74hdct = null;
		}
		ps74hdct = ps74hdst("ps74hdrc()", ps74hdcp);
	}
}
function ps74hdrc() {
	ps74hdct = ps74hdst("ps74hdrc()", ps74hdcp);
	try {
		ps74hdci.src = "http://image.providesupport.com/cmd/thebidetshop?" + "ps_t=" + ps74hdn() + "&ps_l=" + escape(document.location) + "&ps_r=" + escape(document.referrer) + "&ps_s=" + ps74hdsid + "" + "&Website=The+Bidet+Shop&WebsiteAddress=www.thebidetshop.com.au&ReferringPage=Home";
	} catch(e) {
	}
}
ps74hdrc();
var ps74hdcb = "http://image.providesupport.com/image/thebidetshop/online-320783407.gif";
function ps74hdsb(b) {
	if (ps74hdcb != b) {
		var i = document.images['ps74hdimage'];
		if (i != null) {
			i.src = b;
		}
		ps74hdcb = b;
	}
}
// END LIVE CHAT SETTINGS

// NEWSLETTER SUBSCRIBER
// <!--
	$('#subscribe_form').submit(function() {
		if($('#nl_first_name').val() == '') {
			alert('You forgot to type in your first name.');
			$('#nl_first_name').focus();
			return false;
		}

		if($('#nl_email').val() == '') {
			alert('You forgot to type in your email address.');
			$('#nl_email').focus();
			return false;
		}

		if($('#nl_email').val().indexOf('@') == -1 || $('#nl_email').val().indexOf('.') == -1) {
			alert('Please enter a valid email address, such as john@example.com.');
			$('#nl_email').focus();
			$('#nl_email').select();
			return false;
		}

		// Set the action of the form to stop spammers
		$('#subscribe_form').append("<input type=\"hidden\" name=\"check\" value=\"1\" \/>");
		return true;

	});
// -->
// END NEWSLETTER SUBSCRIBER


// HIDE SHOW SCRIPT
function toggle(obj1,obj2){  
	var more=document.getElementById(obj1);  
	var less=document.getElementById(obj2);
	if(!more)return true;  
	if(more.style.display=="none"){  
		more.style.display="block";
		less.style.display="none";
	} else {  
		more.style.display="none";
		less.style.display="block";
	}return true;  
}  
// #end HIDE SHOW SCRIPT
