jQuery.fn.fadeToggle = function(speed, easing, callback) {return this.animate({opacity: 'toggle'}, speed, easing, callback);};

jQuery(document).ready(function(){
	jQuery('a#ad-toggle').click(function() {jQuery('#formbox').fadeToggle("slow"); return false;});	
	jQuery('a#email-toggle').click(function() {jQuery('#email_form_data').fadeToggle("slow"); return false;});
	jQuery("img.size-thumbnail").parent().fancybox({"hideOnContentClick":true,"overlayShow":true,"overlayOpacity":.5,"zoomSpeedIn":300,"zoomSpeedOut":300});
});

function submitWantOffer(value) {
	if (location.search == '') {
		str = location.search;
		if (value != '') str = '?wo='+ value;
		str = str.replace('\&$','');
		str = str.replace('\?$','');
		location.search = str;
	}
	else {
		str = location.search;
		// alert(str);
		str = str.replace(/\&$/,'');
		// alert(str);
		
		if (str.match(/wo=\w+/)) {	
			if (value == '') {
				str = str.replace(/\&?\wo=\w+/,'');
				
			}
			else {
				targetWo = (value == '')?'':'wo='+value;						
				str = str.replace(/wo=\w+/,targetWo);
			}
		} else {
			if (value != '') str += '&wo='+ value;			
		}
		
		str = str.replace('\&$','');
		str = str.replace('\?$','');
		location.search = str;
		
	}
		
	// document.forms.wantofferform.submit();
}

