/*
 * jQuery history plugin
 *
 * Copyright (c) 2006 Taku Sano (Mikage Sawatari)
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Modified by Lincoln Cooper to add Safari support and only call the callback once during initialization
 * for msie when no initial hash supplied.
 */


jQuery.extend({
	historyCurrentHash: undefined,
	
	historyCallback: undefined,
	
	historyInit: function(callback){
		jQuery.historyCallback = callback;
		var current_hash = location.hash;
		
		jQuery.historyCurrentHash = current_hash;
		if(jQuery.browser.msie) {
			// To stop the callback firing twice during initilization if no hash present
			if (jQuery.historyCurrentHash == '') {
			jQuery.historyCurrentHash = '#';
		}
		
			// add hidden iframe for IE
			$("body").prepend('<iframe id="jQuery_history" style="display: none;"></iframe>');
			var ihistory = $("#jQuery_history")[0];
			var iframe = ihistory.contentWindow.document;
			iframe.open();
			iframe.close();
			iframe.location.hash = current_hash;
		}
		else if ($.browser.safari) {
			// etablish back/forward stacks
			jQuery.historyBackStack = [];
			jQuery.historyBackStack.length = history.length;
			jQuery.historyForwardStack = [];
			
			jQuery.isFirst = true;
		}
		jQuery.historyCallback(current_hash.replace(/^#/, ''));
		setInterval(jQuery.historyCheck, 100);
	},
	
	historyAddHistory: function(hash) {
		// This makes the looping function do something
		jQuery.historyBackStack.push(hash);
		
		jQuery.historyForwardStack.length = 0; // clear forwardStack (true click occured)
		this.isFirst = true;
	},
	
	historyCheck: function(){
		if(jQuery.browser.msie) {
			// On IE, check for location.hash of iframe
			var ihistory = $("#jQuery_history")[0];
			var iframe = ihistory.contentDocument || ihistory.contentWindow.document;
			var current_hash = iframe.location.hash;
			if(current_hash != jQuery.historyCurrentHash) {
			
				location.hash = current_hash;
				jQuery.historyCurrentHash = current_hash;
				jQuery.historyCallback(current_hash.replace(/^#/, ''));
				
			}
		} else if ($.browser.safari) {
			if (!jQuery.dontCheck) {
				var historyDelta = history.length - jQuery.historyBackStack.length;
				
				if (historyDelta) { // back or forward button has been pushed
					jQuery.isFirst = false;
					if (historyDelta < 0) { // back button has been pushed
						// move items to forward stack
						for (var i = 0; i < Math.abs(historyDelta); i++) jQuery.historyForwardStack.unshift(jQuery.historyBackStack.pop());
					} else { // forward button has been pushed
						// move items to back stack
						for (var i = 0; i < historyDelta; i++) jQuery.historyBackStack.push(jQuery.historyForwardStack.shift());
					}
					var cachedHash = jQuery.historyBackStack[jQuery.historyBackStack.length - 1];
					if (cachedHash != undefined) {
						jQuery.historyCurrentHash = location.hash;
						jQuery.historyCallback(cachedHash);
					}
				} else if (jQuery.historyBackStack[jQuery.historyBackStack.length - 1] == undefined && !jQuery.isFirst) {
					// back button has been pushed to beginning and URL already pointed to hash (e.g. a bookmark)
					// document.URL doesn't change in Safari
					if (document.URL.indexOf('#') >= 0) {
						jQuery.historyCallback(document.URL.split('#')[1]);
					} else {
						var current_hash = location.hash;
						jQuery.historyCallback('');
					}
					jQuery.isFirst = true;
				}
			}
		} else {
			// otherwise, check for location.hash
			var current_hash = location.hash;
			if(current_hash != jQuery.historyCurrentHash) {
				jQuery.historyCurrentHash = current_hash;
				jQuery.historyCallback(current_hash.replace(/^#/, ''));
			}
		}
	},
	historyLoad: function(hash){
		var newhash;
		
		if (jQuery.browser.safari) {
			newhash = hash;
		}
		else {
			newhash = '#' + hash;
			location.hash = newhash;
		}
		jQuery.historyCurrentHash = newhash;
		
		if(jQuery.browser.msie) {
			var ihistory = $("#jQuery_history")[0];
			var iframe = ihistory.contentWindow.document;
			iframe.open();
			iframe.close();
			iframe.location.hash = newhash;
			jQuery.historyCallback(hash);
		}
		else if (jQuery.browser.safari) {
			jQuery.dontCheck = true;
			// Manually keep track of the history values for Safari
			this.historyAddHistory(hash);
			
			// Wait a while before allowing checking so that Safari has time to update the "history" object
			// correctly (otherwise the check loop would detect a false change in hash).
			var fn = function() {jQuery.dontCheck = false;};
			window.setTimeout(fn, 200);
			jQuery.historyCallback(hash);
			// N.B. "location.hash=" must be the last line of code for Safari as execution stops afterwards.
			//      By explicitly using the "location.hash" command (instead of using a variable set to "location.hash") the
			//      URL in the browser and the "history" object are both updated correctly.
			location.hash = newhash;
		}
		else {
		  jQuery.historyCallback(hash);
		}
	}
});

/**
 * Version: 2.7.3
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(4($){$.2l({8:{2o:0}});$.1C.8=4(x,w){3(J x==\'2L\')w=x;w=$.2l({I:(x&&J x==\'1Y\'&&x>0)?--x:0,X:A,E:$.1b?2g:N,15:N,1m:\'2K&#2F;\',20:\'15-2x-\',1A:A,1y:A,1w:A,1v:A,1t:\'2p\',2n:A,2k:A,2j:N,2i:A,1a:A,1c:A,1h:\'8-1J\',G:\'8-26\',17:\'8-X\',18:\'8-25\',1l:\'8-1I\',1Q:\'8-2z\',1Z:\'Y\'},w||{});$.6.1j=$.6.1j||$.6.R&&J 2u==\'4\';4 1x(){1W(0,0)}D 5.L(4(){2 p=5;2 r=$(\'Z.\'+w.1h,p);r=r.V()&&r||$(\'>Z:7(0)\',p);2 j=$(\'a\',r);3(w.15){j.L(4(){2 c=w.20+(++$.8.2o),z=\'#\'+c,2h=5.1N;5.1N=z;$(\'<Y U="\'+c+\'" 2W="\'+w.18+\'"></Y>\').2d(p);$(5).12(\'1K\',4(e,a){2 b=$(5).K(w.1Q),O=$(\'O\',5)[0],29=O.1F;3(w.1m){O.1F=\'<21>\'+w.1m+\'</21>\'}1n(4(){$(z).2P(2h,4(){3(w.1m){O.1F=29}b.16(w.1Q);a&&a()})},0)})})}2 n=$(\'Y.\'+w.18,p);n=n.V()&&n||$(\'>\'+w.1Z,p);r.T(\'.\'+w.1h)||r.K(w.1h);n.L(4(){2 a=$(5);a.T(\'.\'+w.18)||a.K(w.18)});2 s=$(\'9\',r).23($(\'9.\'+w.G,r)[0]);3(s>=0){w.I=s}3(19.z){j.L(4(i){3(5.z==19.z){w.I=i;3(($.6.R||$.6.2C)&&!w.15){2 a=$(19.z);2 b=a.1e(\'U\');a.1e(\'U\',\'\');1n(4(){a.1e(\'U\',b)},2y)}1x();D N}})}3($.6.R){1x()}n.14(\':7(\'+w.I+\')\').1B().1k().2w(\':7(\'+w.I+\')\').K(w.1l);$(\'9\',r).16(w.G).7(w.I).K(w.G);j.7(w.I).H(\'1K\').1k();3(w.2j){2 l=4(d){2 c=$.2v(n.1r(),4(a){2 h,1z=$(a);3(d){3($.6.1j){a.10.2t(\'1X\');a.10.F=\'\';a.1g=A}h=1z.W({\'1f-F\':\'\'}).F()}B{h=1z.F()}D h}).2s(4(a,b){D b-a});3($.6.1j){n.L(4(){5.1g=c[0]+\'1V\';5.10.2r(\'1X\',\'5.10.F = 5.1g ? 5.1g : "2q"\')})}B{n.W({\'1f-F\':c[0]+\'1V\'})}};l();2 q=p.1U;2 m=p.1i;2 v=$(\'#8-1T-1S-V\').1r(0)||$(\'<O U="8-1T-1S-V">M</O>\').W({2m:\'34\',32:\'30\',2Z:\'2Y\'}).2d(S.1R).1r(0);2 o=v.1i;2X(4(){2 b=p.1U;2 a=p.1i;2 c=v.1i;3(a>m||b!=q||c!=o){l((b>q||c<o));q=b;m=a;o=c}},1P)}2 u={},11={},1O=w.2n||w.1t,1M=w.2k||w.1t;3(w.1y||w.1A){3(w.1y){u[\'F\']=\'1B\';11[\'F\']=\'1I\'}3(w.1A){u[\'P\']=\'1B\';11[\'P\']=\'1I\'}}B{3(w.1w){u=w.1w}B{u[\'1f-2f\']=0;1O=w.E?1P:1}3(w.1v){11=w.1v}B{11[\'1f-2f\']=0;1M=w.E?1P:1}}2 t=w.2i,1a=w.1a,1c=w.1c;j.12(\'2e\',4(){2 c=$(5).1d(\'9:7(0)\');3(p.1p||c.T(\'.\'+w.G)||c.T(\'.\'+w.17)){D N}2 a=5.z;3($.6.R){$(5).H(\'13\');3(w.E){$.1b.1L(a);19.z=a.1u(\'#\',\'\')}}B 3($.6.1s){2 b=$(\'<2b 2V="\'+a+\'"><Y><2U 2T="2a" 2S="h" /></Y></2b>\').1r(0);b.2a();$(5).H(\'13\');3(w.E){$.1b.1L(a)}}B{3(w.E){19.z=a.1u(\'#\',\'\')}B{$(5).H(\'13\')}}});j.12(\'1H\',4(){2 a=$(5).1d(\'9:7(0)\');3($.6.1s){a.1o({P:0},1,4(){a.W({P:\'\'})})}a.K(w.17)});3(w.X&&w.X.1G){28(2 i=0,k=w.X.1G;i<k;i++){j.7(--w.X[i]).H(\'1H\').1k()}};j.12(\'27\',4(){2 a=$(5).1d(\'9:7(0)\');a.16(w.17);3($.6.1s){a.1o({P:1},1,4(){a.W({P:\'\'})})}});j.12(\'13\',4(e){2 g=e.2Q;2 f=5,9=$(5).1d(\'9:7(0)\'),C=$(5.z),Q=n.14(\':2O\');3(p[\'1p\']||9.T(\'.\'+w.G)||9.T(\'.\'+w.17)||J t==\'4\'&&t(5,C[0],Q[0])===N){5.24();D N}p[\'1p\']=2g;3(C.V()){3($.6.R&&w.E){2 d=5.z.1u(\'#\',\'\');C.1e(\'U\',\'\');1n(4(){C.1e(\'U\',d)},0)}4 1E(){3(w.E&&g){$.1b.1L(f.z)}Q.1o(11,1M,4(){$(f).1d(\'9:7(0)\').K(w.G).2N().16(w.G);3(J 1a==\'4\'){1a(f,C[0],Q[0])}2 a={2m:\'\',2M:\'\',F:\'\'};3(!$.6.R){a[\'P\']=\'\'}Q.K(w.1l).W(a);C.16(w.1l).1o(u,1O,4(){C.W(a);3($.6.R){Q[0].10.14=\'\';C[0].10.14=\'\'}3(J 1c==\'4\'){1c(f,C[0],Q[0])}p[\'1p\']=A})})}3(!w.15){1E()}B{$(f).H(\'1K\',[1E])}}B{2J(\'2I T 2H 2R 25.\')}2 b=1D.2G||S.1q&&S.1q.2c||S.1R.2c||0;2 c=1D.2E||S.1q&&S.1q.22||S.1R.22||0;1n(4(){1D.1W(b,c)},0);5.24();D w.E&&!!g});3(w.E){$.1b.2D(4(){j.7(w.I).H(\'13\').1k()})}})};2 y=[\'2e\',\'1H\',\'27\'];28(2 i=0;i<y.1G;i++){$.1C[y[i]]=(4(d){D 4(c){D 5.L(4(){2 b=$(\'Z.8-1J\',5);b=b.V()&&b||$(\'>Z:7(0)\',5);2 a;3(!c||J c==\'1Y\'){a=$(\'9 a\',b).7((c&&c>0&&c-1||0))}B 3(J c==\'2B\'){a=$(\'9 a[@1N$="#\'+c+\'"]\',b)}a.H(d)})}})(y[i])}$.1C.31=4(){2 c=[];5.L(4(){2 a=$(\'Z.8-1J\',5);a=a.V()&&a||$(\'>Z:7(0)\',5);2 b=$(\'9\',a);c.2A(b.23(b.14(\'.8-26\')[0])+1)});D c[0]}})(33);',62,191,'||var|if|function|this|browser|eq|tabs|li||||||||||||||||||||||||||hash|null|else|toShow|return|bookmarkable|height|selectedClass|trigger|initial|typeof|addClass|each||false|span|opacity|toHide|msie|document|is|id|size|css|disabled|div|ul|style|hideAnim|bind|click|filter|remote|removeClass|disabledClass|containerClass|location|onHide|ajaxHistory|onShow|parents|attr|min|minHeight|navClass|offsetHeight|msie6|end|hideClass|spinner|setTimeout|animate|locked|documentElement|get|safari|fxSpeed|replace|fxHide|fxShow|unFocus|fxSlide|jq|fxFade|show|fn|window|switchTab|innerHTML|length|disableTab|hide|nav|loadRemoteTab|update|hideSpeed|href|showSpeed|50|loadingClass|body|font|watch|offsetWidth|px|scrollTo|behaviour|number|tabStruct|hashPrefix|em|scrollTop|index|blur|container|selected|enableTab|for|tabTitle|submit|form|scrollLeft|appendTo|triggerTab|width|true|url|onClick|fxAutoHeight|fxHideSpeed|extend|display|fxShowSpeed|remoteCount|normal|1px|setExpression|sort|removeExpression|XMLHttpRequest|map|not|tab|500|loading|push|string|opera|initialize|pageYOffset|8230|pageXOffset|no|There|alert|Loading|object|overflow|siblings|visible|load|clientX|such|value|type|input|action|class|setInterval|hidden|visibility|absolute|activeTab|position|jQuery|block'.split('|'),0,{}))
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        var path = options.path ? '; path=' + options.path : '';
        var domain = options.domain ? '; domain=' + options.domain : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
(function($){$.dimensions={version:'1.2'};$.each(['Height','Width'],function(i,name){$.fn['inner'+name]=function(){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';return this.is(':visible')?this[0]['client'+name]:num(this,name.toLowerCase())+num(this,'padding'+torl)+num(this,'padding'+borr);};$.fn['outer'+name]=function(options){if(!this[0])return;var torl=name=='Height'?'Top':'Left',borr=name=='Height'?'Bottom':'Right';options=$.extend({margin:false},options||{});var val=this.is(':visible')?this[0]['offset'+name]:num(this,name.toLowerCase())+num(this,'border'+torl+'Width')+num(this,'border'+borr+'Width')+num(this,'padding'+torl)+num(this,'padding'+borr);return val+(options.margin?(num(this,'margin'+torl)+num(this,'margin'+borr)):0);};});$.each(['Left','Top'],function(i,name){$.fn['scroll'+name]=function(val){if(!this[0])return;return val!=undefined?this.each(function(){this==window||this==document?window.scrollTo(name=='Left'?val:$(window)['scrollLeft'](),name=='Top'?val:$(window)['scrollTop']()):this['scroll'+name]=val;}):this[0]==window||this[0]==document?self[(name=='Left'?'pageXOffset':'pageYOffset')]||$.boxModel&&document.documentElement['scroll'+name]||document.body['scroll'+name]:this[0]['scroll'+name];};});$.fn.extend({position:function(){var left=0,top=0,elem=this[0],offset,parentOffset,offsetParent,results;if(elem){offsetParent=this.offsetParent();offset=this.offset();parentOffset=offsetParent.offset();offset.top-=num(elem,'marginTop');offset.left-=num(elem,'marginLeft');parentOffset.top+=num(offsetParent,'borderTopWidth');parentOffset.left+=num(offsetParent,'borderLeftWidth');results={top:offset.top-parentOffset.top,left:offset.left-parentOffset.left};}return results;},offsetParent:function(){var offsetParent=this[0].offsetParent;while(offsetParent&&(!/^body|html$/i.test(offsetParent.tagName)&&$.css(offsetParent,'position')=='static'))offsetParent=offsetParent.offsetParent;return $(offsetParent);}});function num(el,prop){return parseInt($.curCSS(el.jquery?el[0]:el,prop,true))||0;};})(jQuery);
(function($){var helper={},current,title,tID,IE=$.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),track=false;$.Tooltip={blocked:false,defaults:{delay:200,showURL:true,extraClass:"",top:15,left:15},block:function(){$.Tooltip.blocked=!$.Tooltip.blocked;}};$.fn.extend({Tooltip:function(settings){settings=$.extend({},$.Tooltip.defaults,settings);createHelper();return this.each(function(){this.tSettings=settings;this.tooltipText=this.title;$(this).removeAttr("title");this.alt="";}).hover(save,hide).click(hide);},fixPNG:IE?function(){return this.each(function(){var image=$(this).css('backgroundImage');if(image.match(/^url\(["']?(.*\.png)["']?\)$/i)){image=RegExp.$1;$(this).css({'backgroundImage':'none','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+image+"')"}).each(function(){var position=$(this).css('position');if(position!='absolute'&&position!='relative')$(this).css('position','relative');});}});}:function(){return this;},unfixPNG:IE?function(){return this.each(function(){$(this).css({'filter':'',backgroundImage:''});});}:function(){return this;},hideWhenEmpty:function(){return this.each(function(){$(this)[$(this).html()?"show":"hide"]();});},url:function(){return this.attr('href')||this.attr('src');}});function createHelper(){if(helper.parent)return;helper.parent=$('<div id="tooltip"><h3></h3><div class="body"></div><div class="url"></div></div>').hide().appendTo('body');if($.fn.bgiframe)helper.parent.bgiframe();helper.title=$('h3',helper.parent);helper.body=$('div.body',helper.parent);helper.url=$('div.url',helper.parent);}function handle(event){if(this.tSettings.delay)tID=setTimeout(show,this.tSettings.delay);else
show();track=!!this.tSettings.track;$('body').bind('mousemove',update);update(event);}function save(){if($.Tooltip.blocked||this==current||!this.tooltipText)return;current=this;title=this.tooltipText;if(this.tSettings.bodyHandler){helper.title.hide();helper.body.html(this.tSettings.bodyHandler.call(this)).show();}else if(this.tSettings.showBody){var parts=title.split(this.tSettings.showBody);helper.title.html(parts.shift()).show();helper.body.empty();for(var i=0,part;part=parts[i];i++){if(i>0)helper.body.append("<br/>");helper.body.append(part);}helper.body.hideWhenEmpty();}else{helper.title.html(title).show();helper.body.hide();}if(this.tSettings.showURL&&$(this).url())helper.url.html($(this).url().replace('http://','')).show();else
helper.url.hide();helper.parent.addClass(this.tSettings.extraClass);if(this.tSettings.fixPNG)helper.parent.fixPNG();handle.apply(this,arguments);}function show(){tID=null;helper.parent.show();update();}function update(event){if($.Tooltip.blocked)return;if(!track&&helper.parent.is(":visible")){$('body').unbind('mousemove',update)}if(current==null){$('body').unbind('mousemove',update);return;}var left=helper.parent[0].offsetLeft;var top=helper.parent[0].offsetTop;if(event){left=event.pageX+current.tSettings.left;top=event.pageY+current.tSettings.top;helper.parent.css({left:left+'px',top:top+'px'});}var v=viewport(),h=helper.parent[0];if(v.x+v.cx<h.offsetLeft+h.offsetWidth){left-=h.offsetWidth+20+current.tSettings.left;helper.parent.css({left:left+'px'});}if(v.y+v.cy<h.offsetTop+h.offsetHeight){top-=h.offsetHeight+20+current.tSettings.top;helper.parent.css({top:top+'px'});}}function viewport(){return{x:$(window).scrollLeft(),y:$(window).scrollTop(),cx:$(window).width(),cy:$(window).height()};}function hide(event){if($.Tooltip.blocked)return;if(tID)clearTimeout(tID);current=null;helper.parent.hide().removeClass(this.tSettings.extraClass);if(this.tSettings.fixPNG)helper.parent.unfixPNG();}})(jQuery);
$(document).ready(function(){
$('.j-tip').Tooltip({showURL: false, showBody: "|"});	
	$('#body-resort .container').tabs({ fxFade: true, fxSpeed: 'fast'});
	$('#body-timeshare .container').tabs({ fxFade: true, fxSpeed: 'fast', fxAutoHeight: true });
	var TABS_COOKIE = 'tabs_cookie';
	$('.container-table').tabs(parseInt($.cookie(TABS_COOKIE)) || 1, {fxFade: true, fxSpeed: 'fast', onClick: function(clicked) {
        var lastTab = $(clicked).parents('ul').find('li').index(clicked.parentNode) + 1;
        $.cookie(TABS_COOKIE, lastTab);
    }});
	$('th.field-title').css("cursor","pointer");
	$('.q').focus(function(){$(this).val('');});
	$('.q').blur(function(){if($(this).val() == '') {$(this).val('Enter 6 or 7 digit ad #');}});
	$('#tn-buy').click(function() {$('#sales-nav').css("display","block");$('#rentals-nav').css("display","none");});
	$('#tn-rent').click(function() {$('#rentals-nav').css("display","block");$('#sales-nav').css("display","none");});
	var nn = $('#buy').css('display');
	if(nn == 'block') {
		$('#rentals-nav').css("display","none");
	} else {
		$('#sales-nav').css("display","none");
	}
	// Initialize history plugin.
	// The callback is called at once by present location.hash. 
	$.historyInit(function (hash) {if(hash) { $('.container-table').triggerTab(hash); }	});
	
	// set onlick event for buttons
	$("a[@rel='history']").click(function(){
		// 
		var hash = this.href;
		hash = hash.replace(/^.*#/, '');
		// moves to a new page. 
		// pageload is called at once. 
		$.historyLoad(hash);
		return false;
	});

	$('#pageform-public_forms-cms_webad_moreinfo .submit').click(function() {
		bar = 0;
		$('#pageform-public_forms-cms_webad_moreinfo div.required .required').each(function(i){
			if($(this).val() == '') {
				bar = 1;
				$(this).css("border-color","red");	
				var foo = $(this).parent();
				$(foo).css("color","#990000");	
				$(foo).css("font-weight","bold");	
			} else {
				$(this).css("color","#333333");
				$(this).css("border-color","#000000");	
				var foo = $(this).parent();
				$(foo).css("color","#333333");
			}
		});
		if(bar == 1) {
			alert("It seems that you missed some mandatory fields. \nPlease ensure that all of the fields in red have been filled out.");
			return false;					 
		}
	});
	$('#pageform-public_forms-cms_webad_offer .submit').click(function() {
		bar = 0;
		$('#pageform-public_forms-cms_webad_offer div.required .required').each(function(i){
			if($(this).val() == '') {
				bar = 1;
				$(this).css("border-color","red");	
				var foo = $(this).parent();
				$(foo).css("color","#990000");	
				$(foo).css("font-weight","bold");	
			} else {
				$(this).css("color","#333333");
				$(this).css("border-color","#000000");	
				var foo = $(this).parent();
				$(foo).css("color","#333333");
			}
		});
		if(bar == 1) {
			alert("It seems that you missed some mandatory fields. \nPlease ensure that all of the fields in red have been filled out.");
			return false;					 
		}
	});
	$('#pageform-public_forms-callback .submit').click(function() {
		bar = 0;
		$('#pageform-public_forms-callback div.required .required').each(function(i){
			if($(this).val() == '') {
				bar = 1;
				$(this).css("border-color","red");	
				var foo = $(this).parent();
				$(foo).css("color","#990000");	
				$(foo).css("font-weight","bold");	
			} else {
				$(this).css("color","#333333");
				$(this).css("border-color","#000000");	
				var foo = $(this).parent();
				$(foo).css("color","#333333");
			}
		});
		if(bar == 1) {
			alert("It seems that you missed some mandatory fields. \nPlease ensure that all of the fields in red have been filled out.");
			return false;					 
		}
	});
	$('#pageform-public_forms-contact .submit').click(function() {
		bar = 0;
		$('#pageform-public_forms-contact div.required .required').each(function(i){
			if($(this).val() == '') {
				bar = 1;
				$(this).css("border-color","red");	
				var foo = $(this).parent();
				$(foo).css("color","#990000");	
				$(foo).css("font-weight","bold");	
			} else {
				$(this).css("color","#333333");
				$(this).css("border-color","#000000");	
				var foo = $(this).parent();
				$(foo).css("color","#333333");
			}
		});
		if(bar == 1) {
			alert("It seems that you missed some mandatory fields. \nPlease ensure that all of the fields in red have been filled out.");
			return false;					 
		}
	});
	$('#pageform-public_forms-callback .submit').click(function() {
		bar = 0;
		$('#pageform-public_forms-contact div.required .required').each(function(i){
			if($(this).val() == '') {
				bar = 1;
				$(this).css("border-color","red");	
				var foo = $(this).parent();
				$(foo).css("color","#990000");	
				$(foo).css("font-weight","bold");	
			} else {
				$(this).css("color","#333333");
				$(this).css("border-color","#000000");	
				var foo = $(this).parent();
				$(foo).css("color","#333333");
			}
		});
		if(bar == 1) {
			alert("It seems that you missed some mandatory fields. \nPlease ensure that all of the fields in red have been filled out.");
			return false;					 
		}
	});
	$('#pageform-public_forms-infokit .submit').click(function() {
		bar = 0;
		$('#pageform-public_forms-infokit div.required .required').each(function(i){
			if($(this).val() == '') {
				bar = 1;
				$(this).css("border-color","red");	
				var foo = $(this).parent();
				$(foo).css("color","#990000");	
				$(foo).css("font-weight","bold");	
			} else {
				$(this).css("color","#333333");
				$(this).css("border-color","#000000");	
				var foo = $(this).parent();
				$(foo).css("color","#333333");
			}
		});
		if(bar == 1) {
			alert("It seems that you missed some mandatory fields. \nPlease ensure that all of the fields in red have been filled out.");
			return false;					 
		}
	});

	$('#boxsearch button').click(function() {
		bar = 0;
		if($('#q').val() == 'Enter 6 or 7 digit ad #') {
			alert("An ad number should be a 6 or 7 digit number. \nExample: '123456'.");
			return false;
		} else return true;

	});


});
function showPic (el) { 
	if (document.getElementById) { 
		document.getElementById('pic-box-main').src = el.href; 
		return true; 
	} else { 
		return true; 
	} 
}
function goto_page(el){
	if(el.options[el.selectedIndex].value != '-') {
		document.location.href = el.options[el.selectedIndex].value;
	}
}
function cityClick(area_str, url_str) {
	createCookie('fmap',null,-1);
	createCookie('fmap',area_str,1);
	window.location = url_str;
}
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}
