function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=450,height=280,screenX=150,screenY=150,top=150,left=150')
}
function popupWindowLrg(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=700,height=500,screenX=50,screenY=50,top=50,left=50')
}

jQuery.fn.replaceAttr = function(aName, rxString, repString) {
    return this.attr(aName, function(){ 
	   	return jQuery(this).attr(aName).replace(rxString, repString);
	});

}; 

jQuery(document).ready(function() {
	if ('function' == typeof $.gaTracker) $.gaTracker('UA-4299259-1');
	//fixes images and flash that break on local machine
	if(this.location.href.indexOf('localhost') != -1){
		jQuery('img').replaceAttr('src', '\/images\/mebath\/image', 'images\/mebath\/image');
		jQuery('embed').replaceAttr('src', '\/images\/mebath\/flash', 'images\/mebath\/flash');
	}
	var value = "Enter your email address";
	//auto-fill header newsletter signup input
	/*jQuery('#header_newsletter_input').val(value);
	jQuery('#header_newsletter_input').focus(function(){
		if(jQuery(this).val() == value){
			jQuery(this).val('');
		};
	});
	jQuery('#header_newsletter_input').blur(function(){
		if(jQuery(this).val() == ''){
			jQuery(this).val(value);
		};
	});*/
	//auto-fill newsletter signup input
	if(jQuery('#newsletter_input').val() == ''){
		jQuery('#newsletter_input').val(value);
	}
	jQuery('#newsletter_input').focus(function(){
		if(jQuery(this).val() == value){
			jQuery(this).val('');
		};
	});
	jQuery('#newsletter_input').blur(function(){
		if(jQuery(this).val() == ''){
			jQuery(this).val(value);
		};
	});
	//set Home Spa current month icon to correct div according to month
	var divs = jQuery('#ezPageDefault div .productListing-data');
	var myDate = new Date();
	var month = myDate.getMonth()%3;
	jQuery(divs[month]).append('<div class="currentContinuity"><img src="/images/mebath/image/home_spa/current_month_'+month+'.png" /></div>');
	jQuery('#homespa-header-img').css('background-image','url(/images/mebath/image/home_spa/callout_image_'+month+'.jpg)');

	//add ordering instructions to Ice Cream Social page
	if(location.href.indexOf('ice-cream-social') != -1){
		jQuery('#purchase-info').html('<p>To choose kits, enter the quantity into the box on the right, then scroll to the bottom of the page and click "Add Selected Items to Cart" button.<br /><span style="color:#D32364; font-weight:bold;">To select hostess flavor, please click on flavor image and check hostess box.</span></p>');
	}
});