function sefix(e) {
	if ((typeof(e)!='undefined' && e.length<1) || typeof(e)=='undefined') {
		e = jQ('.deforma select.required').not('.LV_valid_field');
	}
	setTimeout(function(){
	//	alert('ss');
		jQ(e).each(function(){
			if (jQ(this).hasClass('required') && !jQ(this).hasClass('LV_valid_field')) {
				jQ(this).closest('div').append('<span class=" LV_validation_message LV_invalid">This field is required</span>');
			}
		});
	},50);
}


function deforma() {
	jQ('.deforma input,.deforma select,.deforma textarea').each(function(){
		jQ(this).closest('div').addClass('formdiv '+jQ(this).attr('name')+' tgt_'+this.tagName.toLowerCase());
	});
	jQ('.deforma select').change(function(){
		sefix(this);
	});
	jQ('.deforma #sbmbu').click(function(){
		sefix(Array());
		setTimeout(function(){
			e = jQ('.deforma .required').not('.LV_valid_field');
			if (e.length>0) {
				e[0].scrollIntoView();
				window.scrollBy(0,-20);
			}
		},100);
	});
	
	jQ('.deforma select').blur(function(){
		e = this;
		setTimeout(function(){
		//	alert('ss');
			if (jQ(e).hasClass('required') && !jQ(e).hasClass('LV_valid_field')) {
				jQ(e).closest('div').append('<span class=" LV_validation_message LV_invalid">This field is required</span>');
			}
		},50);
	});
	jQ('.deforma select').click(function(){
		jQ(this).closest('div').find('span.LV_validation_message.LV_invalid').remove();
	});
	jQ('.deforma input[type="text"]').filter(function(){
		return jQ(this).css('background-image').match(/finput2\.png/);
	}).closest('div').addClass('finput2');
//	jQ(document.body).addClass('mid5');

	jQ('.deforma .formdiv').filter(function(){return this.className.match(/email/);}).addClass('emaila');
}


lbwt = 640;
lbht = 480;
function lightboxclickfix(elm) {
//	return false;
	if (jQ(elm).hasClass('hpvbn') || jQ(elm).hasClass('kitchen_island_pp')) {
	//	alert('hpvbn');
	//	<div class="pp_pic_holder pp_default" style="top: 683.5px; left: 373px; display: block; width: 528px;">
		plrhtml = '<div class="ppt" style="opacity: 1; display: block; width: '+lbwt+'px;">&nbsp;</div>';
	    plrhtml +='<div class="pp_top"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div>';
	    plrhtml +='<div class="pp_content_container"><div class="pp_left"><div class="pp_right">';
		plrhtml +='<div class="pp_content" style="width: '+lbwt+'px; height: '+lbht+'px;">';
		plrhtml +='<div class="pp_fade" style="display: block;">';
		plrhtml +='<div id="pp_full_res" style="display: block;"><iframe scrolling="no" width="'+lbwt+'" height="'+lbht+'" frameborder="no" src="http://rcsgasgrills.com/images/media/v1.html"></iframe></div>';
		plrhtml +='<div class="pp_details" style="width: '+lbwt+'px;"><a href="javascript:void(0);" class="pp_close" style="right:-24px;top:-10px;z-index:10;">Close</a> </div>';
	    plrhtml +='</div></div></div></div></div>';
	    plrhtml +='<div class="pp_bottom"><div class="pp_left"></div><div class="pp_middle"></div><div class="pp_right"></div></div>';
	//	</div>
			
		ifri = setInterval(function(){
			if (jQ('div.pp_details').filter(':visible').length) {
				setTimeout(function(){
					jQ('.pp_pic_holder.pp_default').html(plrhtml);
					jQ('.pp_pic_holder.pp_default').addClass('l50p').css('width',(lbwt+35)+'px').css('margin-left',-1*Math.round((lbwt+35)/2)+'px');
					jQ('.pp_pic_holder.pp_default a.pp_close').click(function(){jQ('.pp_pic_holder.pp_default,.pp_overlay').remove();});
				},100);
				clearInterval(ifri);
			}
		},100);
	}
}






function thankyou() {
	hehml = '<div class="componentheading">'+jQ('td.contentheading').html()+'</div>';
	jQ('td.contentheading').removeClass('contentheading').html(hehml);
	i_headers_rend();
}





function contacts() {
	hehml = '<div class="componentheading">'+jQ('td.contentheading').html()+'</div>';
	jQ('td.contentheading').removeClass('contentheading').html(hehml);
	i_headers_rend();
	if (ie7) jQ('.mid5 .coforma .capt span.ver input').css({left:'244px',
															border:'2px solid black',
															backgroundColor:'#FFF',
															height:'20px',
															top:'353px',
															width:'80px',
															zIndex:'100'});
	jQ('.contbg').before(jQ('.cf_alert'));
	jQ('.contbg').append(jQ('.moduletable_add > .hrs'));
//	jQ('#mainbody > .componentheading').after('<div class="contbg"></div>');
}








function err404() {	jQ('a,form').attr('target','_parent'); }






// dealer reg form
function drf() {
//	console.log('drf');
	headihtml = '<div class="componentheading">'+jQ('.contentpaneopen.dfdfdf td.contentheading.dfdfdf').html()+'</div>';
	jQ('.contentpaneopen.dfdfdf td.contentheading.dfdfdf').removeClass('contentheading').html(headihtml);
	i_headers_rend();
	
	jQ('.contentpaneopen.hyp_content.dfdfdf iframe, .mid253.mid226 .ihrend.deformd').css('height',jQ('#right').height()+'px');
	
	jQ('.mid226 > .bodyjr').css('visibility','visible');

	var currentTime = new Date();
	var month = currentTime.getMonth() + 1;
	var day = currentTime.getDate();
	var year = currentTime.getFullYear();
	
	jQ('input[name="f_date"]').attr('value',month+"/"+day+"/"+year);
}


function find_deal() {
	i_headers_rend();
	jQ(document.body).addClass('fndlr');
}






function pr_root(mprmt) {
	if (mprmt==0) {
		jQ('.bodyjr').addClass('pr-root');
		return;
	}
//	console.log(jQ('.vmCatDesc.catdesc'));
	jQ('.vmCatDesc.catdesc').filter(function(){
		return jQ.trim(jQ(this).html())=='';
	}).remove();
	jQ('.tu>.vmCatDesc.catdesc').attr('style','');
}





function dl_page() {
	dlktr = jQ('.dlitem.pdf').parent();
	jQ(dlktr).find('p').filter(function(){return jQ.trim(jQ(this).html())=='';}).remove();
	jQ(dlktr).addClass('dlktr').append('<div style="clear:both;"><div>');
	jQ('.dlitem>a').each(function(){
		if (jQ(this).height()<64) jQ(this).addClass('nmhei');
		else jQ(this).addClass('tohei');
	});
}
 

