// JavaScript Document
var $j = jQuery.noConflict();

$j(document).ready(function(){		
	$j("#dropdown1, #dropdown2, #dropdown3").msDropDown();
	
	$j('#template_form').submit(function validateQuickForm() {	
		var error = false;
		$j('#template_form input[name!=free_case_evaluation_form]').css('border','#7e8b97 1px solid');
		$j('#template_form select').css('border','#7e8b97 1px solid');
		
		if($j('#template_form input[name=first_name]').val() == '') {
			$j('#template_form input[name=first_name]').css('border','red 1px solid');
			error = true;
		}

		if($j('#template_form input[name=last_name]').val() == '') {
			$j('#template_form input[name=last_name]').css('border','red 1px solid');
			error = true;
		}
		
		if($j('#template_form input[name=i_am_a]').val() == '') {
			$j('#template_form input[name=i_am_a]').css('border','red 1px solid');
			error = true;
		}
		
		if($j('#template_form input[name=interested_in]').val() == '') {
			$j('#template_form input[name=interested_in]').css('border','red 1px solid');
			error = true;
		}
		
		if($j('#template_form input[name=liam]').val() == '') {
			$j('#template_form input[name=liam]').css('border','red 1px solid');
			error = true;
		}
		
		if($j('#template_form input[name=phone]').val() == '' || isNaN($j('#template_form input[name=phone]').val())) {
			$j('#template_form input[name=phone]').css('border','red 1px solid');
			error = true;
		}
		
		if($j('#template_form input[name=phone2]').val() == '' || isNaN($j('#template_form input[name=phone2]').val())) {
			$j('#template_form input[name=phone2]').css('border','red 1px solid');
			error = true;
		}
	
		if($j('#template_form input[name=phone3]').val() == '' || isNaN($j('#template_form input[name=phone3]').val())) {
			$j('#template_form input[name=phone3]').css('border','red 1px solid');
			error = true;
		}
		
		if($j('#template_form select[name=state]').val() == '') {
			$j('#template_form select[name=state]').css('border','red 1px solid');
			error = true;
		}
		
		if(error) {
			return false;
		} else {
			return true;	
		}
	});
		
	$j('#contact form').submit(function validateContact() {	
		var error = false;
		$j('#contact form input[name!=contact]').css('border','#7e8b97 1px solid');
		$j('form select').css('border','#7e8b97 1px solid');
		
		if($j('#contact form input[name=contact_first_name]').val() == '') {
			$j('#contact form input[name=contact_first_name]').css('border','red 1px solid');
			error = true;
		}
		
		if($j('#contact form input[name=contact_last_name]').val() == '') {
			$j('#contact form input[name=contact_last_name]').css('border','red 1px solid');
			error = true;
		}
		
		if($j('#contact form input[name=contact_phone1]').val() == '' || isNaN($j('#contact form input[name=contact_phone1]').val())) {
			$j('#contact form input[name=contact_phone1]').css('border','red 1px solid');
			error = true;
		}
		
		if($j('#contact form input[name=contact_phone2]').val() == '' || isNaN($j('#contact form input[name=contact_phone2]').val())) {
			$j('#contact form input[name=contact_phone2]').css('border','red 1px solid');
			error = true;
		}
	
		if($j('#contact form input[name=contact_phone3]').val() == '' || isNaN($j('#contact form input[name=contact_phone3]').val())) {
			$j('#contact form input[name=contact_phone3]').css('border','red 1px solid');
			error = true;
		}
		
		if($j('#contact form input[name=contact_liam]').val() == '') {
			$j('#contact form input[name=contact_liam]').css('border','red 1px solid');
			error = true;
		}

		if($j('#contact form select[name=contact_state]').val() == '') {
			$j('#contact form select[name=contact_state]').css('border','red 1px solid');
			error = true;
		}
		
		if(error) {
			$j('#message').html('Please correct the fields marked in red');
			return false;
		} else {
			return true;	
		}
	});
	
	$j('#send_friend form').submit(function validateForm() {	
		var error = false;
		$j('form input.required').css('border','#7e8b97 1px solid');
		
		if($j('#send_friend form input[name=contact_name]').val() == '') {
			$j('#send_friend form input[name=contact_name]').css('border','red 1px solid');
			error = true;
		}
		
		if($j('#send_friend form input[name=contact_liam]').val() == '') {
			$j('#send_friend form input[name=contact_liam]').css('border','red 1px solid');
			error = true;
		}

		if($j('#send_friend form input[name=f_name]').val() == '') {
			$j('#send_friend form input[name=f_name]').css('border','red 1px solid');
			error = true;
		}
		
		if($j('#send_friend form input[name=f_liam]').val() == '') {
			$j('#send_friend form input[name=f_liam]').css('border','red 1px solid');
			error = true;
		}
		
		if(error) {
			$j('#message').html('Please correct the fields marked in red');
			return false;
		} else {
			return true;	
		}
	});

	$j('#join_us_form').submit(function validateForm() {	
		var error = false;
		$j('form input.required').css('border','#7e8b97 1px solid');
		
		if($j('#join_us_form input[name=first_name]').val() == '') {
			$j('#join_us_form input[name=first_name]').css('border','red 1px solid');
			error = true;
		}

		if($j('#join_us_form input[name=last_name]').val() == '') {
			$j('#join_us_form input[name=last_name]').css('border','red 1px solid');
			error = true;
		}

		if($j('#join_us_form input[name=company]').val() == '') {
			$j('#join_us_form input[name=company]').css('border','red 1px solid');
			error = true;
		}
		
		if($j('#join_us_form input[name=title]').val() == '') {
			$j('#join_us_form input[name=title]').css('border','red 1px solid');
			error = true;
		}
	
		if($j('#join_us_form input[name=phone1]').val() == '' || isNaN($j('#join_us_form input[name=phone1]').val())) {
			$j('#join_us_form input[name=phone1]').css('border','red 1px solid');
			error = true;
		}
		
		if($j('#join_us_form input[name=phone2]').val() == '' || isNaN($j('#join_us_form input[name=phone2]').val())) {
			$j('#join_us_form input[name=phone2]').css('border','red 1px solid');
			error = true;
		}
	
		if($j('#join_us_form input[name=phone3]').val() == '' || isNaN($j('#join_us_form input[name=phone3]').val())) {
			$j('#join_us_form input[name=phone3]').css('border','red 1px solid');
			error = true;
		}

		if($j('#join_us_form select[name=state]').val() == "") {
			$j('#join_us_form select[name=state]').css('border','red 1px solid');
			error = true;
		}
		
		if($j('#join_us_form input[name=liam]').val() == '') {
			$j('#join_us_form input[name=liam]').css('border','red 1px solid');
			error = true;
		}
	
		if($j('#join_us_form input[name=city]').val() == '') {
			$j('#join_us_form input[name=city]').css('border','red 1px solid');
			error = true;
		}
		
		if(error) {
			$j('#message').html('Please correct the fields marked in red');
			return false;
		} else {
			return true;	
		}
	});
	
	$j('#free_case_evaluation_form').submit(function validateQuickForm() {	
	
		var error = false;
		$j('#free_case_evaluation_form input[name!=free_case_evaluation_form]').css('border','#7e8b97 1px solid');
		$j('#free_case_evaluation_form label').css('color','#fff');
		
		if($j('#free_case_evaluation_form input[name=first_name]').val() == '') {
			$j('#free_case_evaluation_form label[id=first_name]').css('color','red');
			error = true;
		}

		if($j('#free_case_evaluation_form input[name=last_name]').val() == '') {
			$j('#free_case_evaluation_form label[id=last_name]').css('color','red');
			error = true;
		}
		
		if($j('#free_case_evaluation_form input[name=liam]').val() == '') {
			$j('#free_case_evaluation_form label[id=email]').css('color','red');
			error = true;
		}
		
		if($j('#free_case_evaluation_form input[name=phone1]').val() == '' || isNaN($j('#free_case_evaluation_form input[name=phone1]').val())) {
			$j('#free_case_evaluation_form label[id=phone]').css('color','red');
			error = true;
		}
		
		if($j('#free_case_evaluation_form input[name=phone2]').val() == '' || isNaN($j('#free_case_evaluation_form input[name=phone2]').val())) {
			$j('#free_case_evaluation_form label[id=phone]').css('color','red');
			error = true;
		}
	
		if($j('#free_case_evaluation_form input[name=phone3]').val() == '' || isNaN($j('#free_case_evaluation_form input[name=phone3]').val())) {
			$j('#free_case_evaluation_form label[id=phone]').css('color','red');
			error = true;
		}

		if($j('#free_case_evaluation_form select[name=state]').val() == "") {
			$j('#free_case_evaluation_form label[id=state]').css('color','red');
			error = true;
		}

		if($j('#free_case_evaluation_form select[name=i_am]').val() == "") {
			$j('#free_case_evaluation_form label[id=i_am]').css('color','red');
			error = true;
		}
		
		if($j('#free_case_evaluation_form select[name=interested_in]').val() == "") {
			$j('#free_case_evaluation_form label[id=interested_in]').css('color','red');
			error = true;
		}
		
		if(error) {
			return false;
		} else {
			return true;	
		}
	});
	
	$j('#question_form').submit(function validateQuestionForm() {	
		var error = false;
		$j('#question_form input[name!=qa_submit]').css('border','#7e8b97 1px solid');
		$j('#question_form textarea').css('border','#7e8b97 1px solid');
		
		if($j('#question_form input[name=name]').val() == '') {
			$j('#question_form input[name=name]').css('border','red 1px solid');
			error = true;
		}

		if($j('#question_form input[name=liam]').val() == '') {
			$j('#question_form input[name=liam]').css('border','red 1px solid');
			error = true;
		}
		
		if($j('#question_form textarea').val() == '') {
			$j('#question_form textarea').css('border','red 1px solid');
			error = true;
		}
		
		if(error) {
			$j('#question_form #message').html('Please correct the fields marked in red');
			return false;
		} else {
			return true;	
		}
	});
});

var newwindow;
function poptastic(url)
{
	newwindow=window.open(url,'name','height=550,width=490');
	if (window.focus) {newwindow.focus()}
}

function clearText(srcObj){
if(srcObj.title == srcObj.value) srcObj.value = "";
}

function writeText(srcObj){
if(srcObj.value == "") srcObj.value = srcObj.title;
}

// MSDropDown - jquery.dd.js
// author: Marghoob Suleman
// Date: 12th Aug, 2009
// Version: 2.1 {date: 3rd Sep 2009}
// Revision: 25
// web: www.giftlelo.com | www.marghoobsuleman.com
/*
// msDropDown is free jQuery Plugin: you can redistribute it and/or modify
// it under the terms of the either the MIT License or the Gnu General Public License (GPL) Version 2
*/
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}(';(5($){3 D="";$.2h.10=5(v){$O=O;v=$.2T({S:2U,1o:7,2i:23,1h:J,1i:2V,M:\'\'},v);3 w="";3 x={};x.1F=J;x.1p=H;x.1q=1G;3 y=H;2j={1H:\'2W\',1r:\'2X\',1I:\'2Y\',18:\'2Z\',T:\'31\',2k:\'32\',2l:\'33\',34:\'35\',1s:\'36\',2m:\'3a\'};11={10:\'10\',1J:\'1J\',1K:\'1K\',1L:\'1L\',1M:.30};2n={2o:"2p,2q,1N,1O,1P,1Q,1j,1R,1S,1T,3b,1U,1V",3c:"1W,1X,12,3d"};3 z=$(O).8("E");3 A=$(O).8("M");v.M+=(A==Q)?"":A;3 B=$(O).2r();y=($(O).8("1W")>0||$(O).8("1X")==J)?J:H;4(y){v.1o=$(O).8("1W")};3 C={};2s();5 9(a){U z+2j[a]};5 1Y(a){3 b=a;3 c=$(b).8("M");U c};5 1Z(a){3 b=$("#"+z+" 1t:6");4(b.I>1){Y(3 i=0;i<b.I;i++){4(a==b[i].K){U J}}}N 4(b.I==1){4(b[0].K==a){U J}};U H}5 2t(){3 r=B;3 s="";3 t=9("2k");3 u=9("2l");r.2u(5(i){3 j=r[i];4(j.3e=="3f"){s+="<V W=\'3g\'>";s+="<19 M=\'2v-3h:3i;2v-M:3j; 3k:3l;\'>"+$(j).8("3m")+"</19>";3 k=$(j).2r();k.2u(5(a){3 b=k[a];3 c=u+"20"+(i)+"20"+(a);3 d=$(b).8("21");d=(d.I==0)?"":\'<22 24="\'+d+\'" 25="26" /> \';3 e=$(b).R();3 f=$(b).2w();3 g=($(b).8("12")==J)?"12":"1k";C[c]={1a:d+e,28:f,R:e,K:b.K,E:c};3 h=1Y(b);4(1Z(b.K)==J){s+=\'<a 1u="1v:1w(0);" W="6 \'+g+\'"\'}N{s+=\'<a  1u="1v:1w(0);" W="\'+g+\'"\'};4(h!=H)s+=\' M="\'+h+\'"\';s+=\' E="\'+c+\'">\';s+=d+e+\'</a>\'});s+="</V>"}N{3 l=t+"20"+(i);3 m=$(j).8("21");m=(m.I==0)?"":\'<22 24="\'+m+\'" 25="26" /> \';3 n=$(j).R();3 o=$(j).2w();3 p=($(j).8("12")==J)?"12":"1k";C[l]={1a:m+n,28:o,R:n,K:j.K,E:l};3 q=1Y(j);4(1Z(j.K)==J){s+=\'<a 1u="1v:1w(0);" W="6 \'+p+\'"\'}N{s+=\'<a  1u="1v:1w(0);" W="\'+p+\'"\'};4(q!=H)s+=\' M="\'+q+\'"\';s+=\' E="\'+l+\'">\';s+=m+n+\'</a>\'}});U s};5 2x(){3 a=9("1r");3 b=9("T");3 c=v.M;1b="";1b+=\'<V E="\'+b+\'" W="\'+11.1L+\'"\';4(!y){1b+=(c!="")?\' M="\'+c+\'"\':\'\'}N{1b+=(c!="")?\' M="3n-1x:3o 3p #3q;2y:3r;1y:3s;\'+c+\'"\':\'\'}1b+=\'>\';U 1b};5 2z(){3 a=9("1I");3 b=9("1s");3 c=9("18");3 d=9("2m");3 e=$("#"+z+" 1t:6").R();3 f=$("#"+z+" 1t:6").8("21");f=(f.I==0||f==Q||v.1h==H)?"":\'<22 24="\'+f+\'" 25="26" /> \';3 g=\'<V E="\'+a+\'" W="\'+11.1J+\'"\';g+=\'>\';g+=\'<19 E="\'+b+\'" W="\'+11.1K+\'"></19><19 W="3t" E="\'+c+\'">\'+f+e+\'</19></V>\';U g};5 2s(){3 d=H;3 e=9("1r");3 f=9("1I");3 g=9("18");3 h=9("T");3 i=9("1s");3 j=$("#"+z).29();3 k=v.M;4($("#"+e).I>0){$("#"+e).3u();d=J}3 l=\'<V E="\'+e+\'" W="\'+11.10+\'"\';l+=(k!="")?\' M="\'+k+\'"\':\'\';l+=\'>\';4(!y)l+=2z();l+=2x();l+=2t();l+="</V>";l+="</V>";4(d==J){3 m=9("1H");$("#"+m).2a(l)}N{$("#"+z).2a(l)}$("#"+e).P("29",j+"2b");$("#"+h).P("29",(j-2)+"2b");4(B.I>v.1o){3 n=1l($("#"+h+" a:2A").P("2B-3v"))+1l($("#"+h+" a:2A").P("2B-1x"));3 o=((v.2i)*v.1o)-n;$("#"+h).P("S",o+"2b")}4(d==H){2C();2D(z)}4($("#"+z).8("12")==J){$("#"+e).P("2E",11.1M)}N{2F();4(!y){$("#"+f).G("1c",5(a){2c(1)});$("#"+f).G("1z",5(a){2c(0)})};$("#"+h+" a.1k").G("2d",5(a){a.1m();2G(O);4(!y){$("#"+h).14("1c");1d(H);3 b=(v.1h==H)?$(O).R():$(O).1a();1A(b);1B()};1e()});$("#"+h+" a.12").P("2E",11.1M);4(y){$("#"+h).G("1c",5(c){4(!x.1p){x.1p=J;$(F).G("1C",5(a){3 b=a.2H;x.1q=b;4(b==39||b==2I){a.1m();a.1D();2e();1e()};4(b==37||b==38){a.1m();a.1D();2f();1e()}})}})};$("#"+h).G("1z",5(a){1d(H);$(F).14("1C");x.1p=H;x.1q=1G});4(!y){$("#"+f).G("2d",5(b){1d(H);4($("#"+h+":3w").I==1){$("#"+h).14("1c")}N{$("#"+h).G("1c",5(a){1d(J)});2J()}})};$("#"+f).G("1z",5(a){1d(H)})}};5 2K(a){Y(3 i 3x C){4(C[i].K==a){U C[i]}}}5 2G(a){3 b=9("T");4(!y){$("#"+b+" a.6").1f("6")}3 c=$("#"+b+" a.6").8("E");4(c!=Q){3 d=(x.1g==Q||x.1g==1G)?C[c].K:x.1g};4(a&&!y){$(a).15("6")};4(y){3 e=x.1q;4($("#"+z).8("1X")==J){4(e==17){x.1g=C[$(a).8("E")].K;$(a).3y("6")}N 4(e==16){$("#"+b+" a.6").1f("6");$(a).15("6");3 f=$(a).8("E");3 g=C[f].K;Y(3 i=2L.3z(d,g);i<=2L.3A(d,g);i++){$("#"+2K(i).E).15("6")}}N{$("#"+b+" a.6").1f("6");$(a).15("6");x.1g=C[$(a).8("E")].K}}N{$("#"+b+" a.6").1f("6");$(a).15("6");x.1g=C[$(a).8("E")].K}}};5 2D(a){F.L(a).3B=5(e){$("#"+O.E).10(v)}};5 1d(a){x.1F=a};5 2M(){U x.1F};5 2F(){3 b=9("1r");3 c=2n.2o.3C(",");Y(3 d=0;d<c.I;d++){3 e=c[d];3 f=$("#"+z).8(e);4(f!=Q){3D(e){Z"2p":$("#"+b).G("3E",5(a){F.L(z).2N()});X;Z"1O":$("#"+b).G("2d",5(a){F.L(z).1O()});X;Z"1P":$("#"+b).G("3F",5(a){F.L(z).1P()});X;Z"1Q":$("#"+b).G("3G",5(a){F.L(z).1Q()});X;Z"1j":$("#"+b).G("1n",5(a){F.L(z).1j()});X;Z"1R":$("#"+b).G("1c",5(a){F.L(z).1R()});X;Z"1S":$("#"+b).G("3H",5(a){F.L(z).1S()});X;Z"1T":$("#"+b).G("1z",5(a){F.L(z).1T()});X}}}};5 2C(){3 a=9("1H");$("#"+z).2a("<V M=\'S:3I;3J:3K;1y:3L;\' E=\'"+a+"\'></V>");$("#"+z).3M($("#"+a))};5 1A(a){3 b=9("18");$("#"+b).1a(a)};5 2e(){3 a=9("18");3 b=9("T");3 c=$("#"+b+" a.1k");Y(3 d=0;d<c.I;d++){3 e=c[d];3 f=$(e).8("E");4($(e).2O("6")&&d<c.I-1){$("#"+b+" a.6").1f("6");$(c[d+1]).15("6");3 g=$("#"+b+" a.6").8("E");4(!y){3 h=(v.1h==H)?C[g].R:C[g].1a;1A(h)}4(1l(($("#"+g).1y().1x+$("#"+g).S()))>=1l($("#"+b).S())){$("#"+b).1E(($("#"+b).1E())+$("#"+g).S()+$("#"+g).S())};X}}};5 2f(){3 a=9("18");3 b=9("T");3 c=$("#"+b+" a.1k");Y(3 d=0;d<c.I;d++){3 e=c[d];3 f=$(e).8("E");4($(e).2O("6")&&d!=0){$("#"+b+" a.6").1f("6");$(c[d-1]).15("6");3 g=$("#"+b+" a.6").8("E");4(!y){3 h=(v.1h==H)?C[g].R:C[g].1a;1A(h)}4(1l(($("#"+g).1y().1x+$("#"+g).S()))<=0){$("#"+b).1E(($("#"+b).1E()-$("#"+b).S())-$("#"+g).S())};X}}};5 1e(){3 a=9("T");3 b=$("#"+a+" a.6");4(b.I==1){3 c=$("#"+a+" a.6").R();3 d=$("#"+a+" a.6").8("E");4(d!=Q){3 e=C[d].28;F.L(z).3N=C[d].K}}N 4(b.I>1){3 f=$("#"+z+" > 1t:6").3O("6");Y(3 i=0;i<b.I;i++){3 d=$(b[i]).8("E");3 g=C[d].K;F.L(z).3P[g].6="6"}}};5 2J(){3 c=9("T");4(D!=""&&c!=D){$("#"+D).2P("2g");$("#"+D).P({1i:\'0\'})};4($("#"+c).P("2y")=="3Q"){w=C[$("#"+c+" a.6").8("E")].R;$(F).G("1C",5(a){3 b=a.2H;4(b==39||b==2I){a.1m();a.1D();2e()};4(b==37||b==38){a.1m();a.1D();2f()};4(b==27||b==13){1B();1e()};4($("#"+z).8("1U")!=Q){F.L(z).1U()}});$(F).G("2Q",5(a){4($("#"+z).8("1V")!=Q){F.L(z).1V()}});$(F).G("1n",5(a){4(2M()==H){1B()}});$("#"+c).P({1i:v.1i});$("#"+c).3R("2g");4(c!=D){D=c}}};5 1B(){3 b=9("T");$(F).14("1C");$(F).14("2Q");$(F).14("1n");$("#"+b).2P("2g",5(a){2R();$("#"+b).P({1i:\'0\'})})};5 2R(){3 b=9("T");4($("#"+z).8("1N")!=Q){3 c=C[$("#"+b+" a.6").8("E")].R;4(w!=c){F.L(z).1N()}}4($("#"+z).8("1j")!=Q){F.L(z).1j()}4($("#"+z).8("2q")!=Q){$(F).G("1n",5(a){$("#"+z).2N();$("#"+z)[0].3S();1e();$(F).14("1n")})}};5 2c(a){3 b=9("1s");4(a==1)$("#"+b).P({2S:\'0 3T%\'});N $("#"+b).P({2S:\'0 0\'})}};$.2h.3U=5(a){3 b=$(O);Y(3 c=0;c<b.I;c++){3 d=$(b[c]).8("E");4(a==Q){$("#"+d).10()}N{$("#"+d).10(a)}}}})(3V);',62,244,'|||var|if|function|selected||attr|getPostID|||||||||||||||||||||||||||||||id|document|bind|false|length|true|index|getElementById|style|else|this|css|undefined|text|height|postChildID|return|div|class|break|for|case|dd|styles|disabled||unbind|addClass|||postTitleTextID|span|html|sDiv|mouseover|setInsideWindow|setValue|removeClass|oldIndex|showIcon|zIndex|onmouseup|enabled|parseInt|preventDefault|mouseup|visibleRows|keyboardAction|currentKey|postID|postArrowID|option|href|javascript|void|top|position|mouseout|setTitleText|closeMe|keydown|stopPropagation|scrollTop|insideWindow|null|postElementHolder|postTitleID|ddTitle|arrow|ddChild|disbaled|onchange|onclick|ondblclick|onmousedown|onmouseover|onmousemove|onmouseout|onkeydown|onkeyup|size|multiple|getOptionsProperties|matchIndex|_|title|img||src|align|left||value|width|after|px|hightlightArrow|click|next|previous|fast|fn|rowHeight|config|postAID|postOPTAID|postInputhidden|attributes|actions|onfocus|onblur|children|createDropDown|createATags|each|font|val|createChildDiv|display|createTitleDiv|first|padding|setOutOfVision|addNewEvents|opacity|applyEvents|manageSelection|keyCode|40|openMe|getByIndex|Math|getInsideWindow|focus|hasClass|slideUp|keyup|checkMethodAndApply|backgroundPosition|extend|120|9999|_msddHolder|_msdd|_title|_titletext||_child|_msa|_msopta|postInputID|_msinput|_arrow||||_inp|onkeypress|prop|tabindex|nodeName|OPTGROUP|opta|weight|bold|italic|clear|both|label|border|1px|solid|c3c3c3|block|relative|textTitle|remove|bottom|visible|in|toggleClass|min|max|refresh|split|switch|mouseenter|dblclick|mousedown|mousemove|0px|overflow|hidden|absolute|appendTo|selectedIndex|removeAttr|options|none|slideDown|blur|100|msDropDown|jQuery'.split('|'),0,{}))

/*

CUSTOM FORM ELEMENTS

Created by Ryan Fait
www.ryanfait.com

The only things you may need to change in this file are the following
variables: checkboxHeight, radioHeight and selectWidth (lines 24, 25, 26)

The numbers you set for checkboxHeight and radioHeight should be one quarter
of the total height of the image want to use for checkboxes and radio
buttons. Both images should contain the four stages of both inputs stacked
on top of each other in this order: unchecked, unchecked-clicked, checked,
checked-clicked.

You may need to adjust your images a bit if there is a slight vertical
movement during the different stages of the button activation.

The value of selectWidth should be the width of your select list image.

Visit http://ryanfait.com/ for more information.

*/

var checkboxHeight = "25";
var radioHeight = "25";
var selectWidth = "141";


/* No need to change anything after this */


document.write('<style type="text/css">input.styled { display: none; } select.styled { position: relative; width: ' + selectWidth + 'px; opacity: 0; filter: alpha(opacity=0); z-index: 5; } .disabled { opacity: 0.5; filter: alpha(opacity=50); }</style>');

var Custom = {
	init: function() {
		var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active;
		for(a = 0; a < inputs.length; a++) {
			if((inputs[a].type == "checkbox" || inputs[a].type == "radio") && inputs[a].className == "styled") {
				span[a] = document.createElement("span");
				span[a].className = inputs[a].type;

				if(inputs[a].checked == true) {
					if(inputs[a].type == "checkbox") {
						position = "0 -" + (checkboxHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					} else {
						position = "0 -" + (radioHeight*2) + "px";
						span[a].style.backgroundPosition = position;
					}
				}
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				inputs[a].onchange = Custom.clear;
				if(!inputs[a].getAttribute("disabled")) {
					span[a].onmousedown = Custom.pushed;
					span[a].onmouseup = Custom.check;
				} else {
					span[a].className = span[a].className += " disabled";
				}
			}
		}
		inputs = document.getElementsByTagName("select");
		for(a = 0; a < inputs.length; a++) {
			if(inputs[a].className == "styled") {
				option = inputs[a].getElementsByTagName("option");
				active = option[0].childNodes[0].nodeValue;
				textnode = document.createTextNode(active);
				for(b = 0; b < option.length; b++) {
					if(option[b].selected == true) {
						textnode = document.createTextNode(option[b].childNodes[0].nodeValue);
					}
				}
				span[a] = document.createElement("span");
				span[a].className = "select";
				span[a].id = "select" + inputs[a].name;
				span[a].appendChild(textnode);
				inputs[a].parentNode.insertBefore(span[a], inputs[a]);
				if(!inputs[a].getAttribute("disabled")) {
					inputs[a].onchange = Custom.choose;
				} else {
					inputs[a].previousSibling.className = inputs[a].previousSibling.className += " disabled";
				}
			}
		}
		document.onmouseup = Custom.clear;
	},
	pushed: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight*3 + "px";
		} else if(element.checked == true && element.type == "radio") {
			this.style.backgroundPosition = "0 -" + radioHeight*3 + "px";
		} else if(element.checked != true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 -" + checkboxHeight + "px";
		} else {
			this.style.backgroundPosition = "0 -" + radioHeight + "px";
		}
	},
	check: function() {
		element = this.nextSibling;
		if(element.checked == true && element.type == "checkbox") {
			this.style.backgroundPosition = "0 0";
			element.checked = false;
		} else {
			if(element.type == "checkbox") {
				this.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else {
				this.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
				group = this.nextSibling.name;
				inputs = document.getElementsByTagName("input");
				for(a = 0; a < inputs.length; a++) {
					if(inputs[a].name == group && inputs[a] != this.nextSibling) {
						inputs[a].previousSibling.style.backgroundPosition = "0 0";
					}
				}
			}
			element.checked = true;
		}
	},
	clear: function() {
		inputs = document.getElementsByTagName("input");
		for(var b = 0; b < inputs.length; b++) {
			if(inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px";
			} else if(inputs[b].type == "checkbox" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			} else if(inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px";
			} else if(inputs[b].type == "radio" && inputs[b].className == "styled") {
				inputs[b].previousSibling.style.backgroundPosition = "0 0";
			}
		}
	},
	choose: function() {
		option = this.getElementsByTagName("option");
		for(d = 0; d < option.length; d++) {
			if(option[d].selected == true) {
				document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue;
			}
		}
	}
}
window.onload = Custom.init;
