var siteURL='http://www.emuscle.com/';var scrollPos=0;$(document).ready(function(){var checkStyle=$("#learn").css("display");if(checkStyle=='block')
{$("#learn").css("display",'none');}
var checkStyle=$("#join").css("display");if(checkStyle=='block')
{$("#join").css("display",'none');}
var checkStyle=$("#trainIt").css("display");if(checkStyle=='block')
{$("#trainIt").css("display",'none');}
var checkStyle=$("#startIt").css("display");if(checkStyle=='block')
{$("#startIt").css("display",'none');}
$("#learnit").mouseover(function(){var check=$("#learn").css("display");if(check=='none')
{$("#learnTD").removeClass();$("#learnTD").addClass("button-a");}});$("#learnit").mouseout(function(){var check=$("#learn").css("display");if(check=='none')
{$("#learnTD").removeClass();$("#learnTD").addClass("button");}});$("#gainit").mouseover(function(){var check=$("#trainIt").css("display");if(check=='none')
{$("#gainTD").removeClass();$("#gainTD").addClass("button-a");}});$("#gainit").mouseout(function(){var check=$("#trainIt").css("display");if(check=='none')
{$("#gainTD").removeClass();$("#gainTD").addClass("button");}});$("#link").mouseover(function(){var check=document.location.href;var arr=check.split('/');check=arr[arr.length-1];if(check!='link.php')
{$("#linkTD").removeClass();$("#linkTD").addClass("button-a");}});$("#link").mouseout(function(){var check=document.location.href;var arr=check.split('/');check=arr[arr.length-1];if(check!='link.php')
{$("#linkTD").removeClass();$("#linkTD").addClass("button");}});$("#joinnow").mouseover(function(){var check=$("#join").css("display");if(check=='none')
{$("#registerTD").removeClass();$("#registerTD").addClass("button-a");}});$("#joinnow").mouseout(function(){var check=$("#join").css("display");if(check=='none')
{$("#registerTD").removeClass();$("#registerTD").addClass("button");}});$("#signIn").mouseover(function(){$("#signTD").removeClass();$("#signTD").addClass("button-a");});$("#signIn").mouseout(function(){$("#signTD").removeClass();$("#signTD").addClass("button");});});$(document).ready(function(){$("#joinnow,#joinnow2").click(function(){$("#learnTD,#gainTD,#linkTD,#registerTD").removeClass();$("#registerTD").addClass("button-a");$("#learnTD,#gainTD,#linkTD").addClass("button");var checkStyle=$("#connectBox").css("display");if(checkStyle=='block'){$("#connectBox").animate({height:'hide',opacity:'hide'},'slow');}var check=$("#join").css("display");if(check=='none')
{var checkStyle=$("#learn").css("display");if(checkStyle=='block')
{$("#learn").animate({height:'hide',opacity:'hide'},'slow');}
var checkStyle=$("#trainIt").css("display");if(checkStyle=='block')
{$("#trainIt").animate({height:'hide',opacity:'hide'},'slow');}
var checkStyle=$("#startIt").css("display");if(checkStyle=='block')
{$("#startIt").animate({height:'hide',opacity:'hide'},'slow');}
$("#join").animate({height:'show',opacity:'show'},'slow');}
else
{$("#join").animate({height:'hide',opacity:'hide'},'slow');$("#linkPath").css("display","block");}});$("#mailIt").click(function(){var check=$("#mailDv").css("display");if(check=="none")
{$("#mailDv").animate({height:'show',opacity:'show'},'slow');}
else
{$("#mailDv").animate({height:'hide',opacity:'hide'},'slow');}});$("#cancleMailIt").click(function(){$("#mailDv").animate({height:'hide',opacity:'hide'},'slow');});$("#learnit").click(function(){$("#learnTD,#gainTD,#linkTD,#registerTD").removeClass();$("#learnTD").addClass("button-a");$("#gainTD,#linkTD,#registerTD").addClass("button");var checkStyle=$("#connectBox").css("display");if(checkStyle=='block'){$("#connectBox").animate({height:'hide',opacity:'hide'},'slow');}var check=$("#learn").css("display");if(check=='none')
{var checkStyle=$("#join").css("display");if(checkStyle=='block')
{$("#join").animate({height:'hide',opacity:'hide'},'slow');}
var checkStyle=$("#trainIt").css("display");if(checkStyle=='block')
{$("#trainIt").animate({height:'hide',opacity:'hide'},'slow');}
var checkStyle=$("#startIt").css("display");if(checkStyle=='block')
{$("#startIt").animate({height:'hide',opacity:'hide'},'slow');}
checkStyle=$("#linkPath").css("display");if(checkStyle=='block')
{$("#linkPath").css("display","none");}
$("#learn").animate({height:'show',opacity:'show'},'slow');}
else
{$("#linkPath").css("display","block");$("#learn").animate({height:'hide',opacity:'hide'},'slow');}});$('#connectup').click(function(){var checkStyle=$("#join").css("display");if(checkStyle=='block'){$("#join").animate({height:'hide',opacity:'hide'},'slow');}
var checkStyle=$("#learn").css("display");if(checkStyle=='block'){$("#learn").animate({height:'hide',opacity:'hide'},'slow');}
var checkStyle=$("#startIt").css("display");if(checkStyle=='block'){$("#startIt").animate({height:'hide',opacity:'hide'},'slow');}
var checkStyle=$("#linkPath").css("display");if(checkStyle=='block'){$("#linkPath").animate({height:'hide',opacity:'hide'},'slow');}
var checkStyle=$("#trainIt").css("display");if(checkStyle=='block'){$("#trainIt").animate({height:'hide',opacity:'hide'},'slow');}
var checkStyle=$("#connectBox").css("display");if(checkStyle=='block'){$("#connectBox").animate({height:'hide',opacity:'hide'},'slow');}else{$("#connectBox").animate({height:'show',opacity:'show'},'slow');}});$("input[@name=Gender]").click(function(){$('#sex_hid').val($("input[@name=Gender]:checked").val());$('#chkMsg').html('');});$("#learn2").click(function(){$("#learnTD,#gainTD,#linkTD,#registerTD").removeClass();$("#learnTD").addClass("button-a");$("#gainTD,#linkTD,#registerTD").addClass("button");var check=$("#learn").css("display");if(check=='none')
{var checkStyle=$("#connectBox").css("display");if(checkStyle=='block'){$("#connectBox").animate({height:'hide',opacity:'hide'},'slow');}var checkStyle=$("#join").css("display");if(checkStyle=='block')
{$("#join").animate({height:'hide',opacity:'hide'},'slow');}
var checkStyle=$("#startIt").css("display");if(checkStyle=='block')
{$("#startIt").animate({height:'hide',opacity:'hide'},'slow');}
$("#linkPath").css("display","none");$("#learn").animate({height:'show',opacity:'show'},'slow');}
else
{var checkStyle=$("#learn").css("display");if(checkStyle=='block')
{$("#learn").animate({height:'hide',opacity:'hide'},'slow');}
$("#linkPath").css("display","block");}});$("#gainit").click(function(){$("#learnTD,#gainTD,#linkTD,#registerTD").removeClass();$("#gainTD").addClass("button-a");$("#learnTD,#linkTD,#registerTD").addClass("button");var checkStyle=$("#connectBox").css("display");if(checkStyle=='block')
{$("#connectBox").animate({height:'hide',opacity:'hide'},'slow');}
var chkID=$("#joinnow").attr("id");var check=$("#trainIt").css("display");if(check=='none')
{var checkStyle=$("#join").css("display");if(checkStyle=='block')
{$("#join").animate({height:'hide',opacity:'hide'},'slow');}
var checkStyle=$("#learn").css("display");if(checkStyle=='block')
{$("#learn").animate({height:'hide',opacity:'hide'},'slow');}
$("#trainIt").animate({height:'show',opacity:'show'},'slow');}
else
{$("#trainIt").animate({height:'hide',opacity:'hide'},'slow');}});$("#closeBox").click(function(){$("#startIt").hide();});$("#trainIt2").click(function(){$("#learnTD,#gainTD,#linkTD,#registerTD").removeClass();$("#gainTD").addClass("button-a");$("#learnTD,#linkTD,#registerTD").addClass("button");var check=$("#trainIt").css("display");if(check=='none')
{var checkStyle=$("#learn").css("display");if(checkStyle=='block')
{$("#learn").animate({height:'hide',opacity:'hide'},'slow');}
$("#trainIt").animate({height:'show',opacity:'show'},'slow');}
else
{$("#trainIt").animate({height:'hide',opacity:'hide'},'slow');}});$("#cancleRegister").click(function(){$("#join").animate({height:'hide',opacity:'hide'},'slow');$("#linkPath").css("display","block");});});$(document).ready(function(){$('#signIn,#signIn2,.start').click(function(){tb_show('Member Login',siteURL+'logIn.php?width=280&height=260','');});$('#Check').click(function(){if($(this).attr('checked')==true){$('#TrainerBox').show().slideDown();}else{$('#TrainerBox').hide().slideUp();}});$.validator.addMethod("check_date",function(){var regExp=/^\d{4}[\/-]\d{1,2}[\/-]\d{1,2}$/;if(regExp.test($("#Birth_YY").val()+"-"+$("#Birth_MM").val()+"-"+$("#Birth_DD").val())!=true)
return false;else
return true;},'Your birth date, please');$.validator.addMethod("check_height",function(){var regExp=/^\d{2}$/;if(($("#Height_Ft").val()=='')||($("#Height_Inch").val()==''))
return false;else
return true;},'Your height, please');$("#FirstName,#LastName").blur(function(){$("#ScreenName").val($("#FirstName").val()+$("#LastName").val());});$('#register').click(function(){$("#register").unbind("click");$('#joinForm').validate({onkeyup:false,onsubmit:true,submitHandler:function(form){var str='';$("#SpecialtyID option:selected").each(function(){if(str==''){str+=$(this).val();}else{str+=','+$(this).val();}});if($('#Check').attr("checked")==true)
{$('#Specialty').val(str);if($('#Criteria1').attr("checked")==true||$('#Criteria2').attr("checked")==true||$('#Criteria3').attr("checked")==true||$('#Criteria4').attr("checked")==true||$('#Criteria5').attr("checked")==true)
{$('#criteriaMsg').html('&nbsp;');var pos=$('#ScreenName').val().indexOf(' ');if(pos>=0)
{$('#registerMsg').html('Spaces not allowed in screen name.');var a=$('#ScreenName').val();a=a.split(" ").join("");$('#ScreenName').val(a);return false;}else{register();}}
else
{$('#criteriaMsg').html('<span classs="error_msg">Your criteria, please!</span>');}}else
{var pos=$('#ScreenName').val().indexOf(' ');if(pos>=0)
{$('#registerMsg').html('Spaces not allowed in screen name.');var a=$('#ScreenName').val();a=a.split(" ").join("");$('#ScreenName').val(a);return false;}
else
{var html = $.ajax({ url: siteURL+"checkAge.php", type: "GET", data: "Date="+$("#Birth_YY").val()+'-'+$("#Birth_MM").val()+'-'+$("#Birth_DD").val(), async: false }).responseText; if(html < 13) {$('#registerMsg').html('You must be at least 13 years of age.'); return false; } else { register(); }}}},rules:{sex_hid:"required",FirstName:"required",LastName:"required",RegEmail:{required:true,email:true},RegPassword:{required:true,minLength:6,maxLength:10},ConfirmPassword:{required:true,equalTo:"#RegPassword"},Height_Inch:"check_height",Zip:"required",Birth_YY:"check_date",ScreenName:{required:"#ScreenCheck:unchecked"},SpecialtyID:{required:"#Check:checked"},Desc:{required:"#Check:checked"},Agree:"required"},messages:{sex_hid:"Your gender, please!",FirstName:"Your first name, please!",LastName:"Your last name, please!",RegEmail:{required:"Your email, please!",email:"Your valid email, please!"},RegPassword:{required:"Your password, please!",minLength:"Your password must contain at least six charecter!",maxLength:"Your password can not greater than ten charecter!"},ConfirmPassword:{required:"Your confirm password, please!",equalTo:"Your passwords do not match!"},Zip:"Your zip code, please!",ScreenName:{required:"Your screen name, please!"},SpecialtyID:{required:"Your specialty, please!"},Desc:{required:"Your description, please!"},Agree:"Please agree'."}});});$("#cancleRegister,#joinnow").click(function(){$("#registerMsg").html("");});var checkStyle=$("#connectBox").css("display");if(checkStyle=='block'){$("#connectBox").animate({height:'hide',opacity:'hide'},'slow');}$('#close,#forgotClose').click(function(){$(".dropdown1").show();$("#light").css("display","none");$("#fade").css("display","none");$("#light2").css("display","none");});$('#sendFeedback').click(function(){$('#frmcomment').validate({submitHandler:function(form){$.ajax({type:"POST",url:siteURL+"ajaxfeedback.php",data:"Name="+$('#F_Name').val()+"&Email="+$('#F_Email').val()+"&Message="+$('#F_Comment').val()+"&Captcha="+$('#Captcha').val(),success:function(msg){$('#fmsg').html('<strong>'+msg+'</strong>');return false;}});},rules:{F_Name:"required",F_Email:{required:true,email:true},Captcha:"required",F_Comment:"required"},messages:{F_Name:"Your name, please!",F_Email:{required:"Your email, please!",email:"Your valid email, please!"},Captcha:"Enter text, please!",F_Comment:"Your comment, please!"}});});});function register()
{var uid=$("#RegEmail").val();var pwd=$("#RegPassword").val();var fname=$("#FirstName").val();var lname=$("#LastName").val();var sex=$("input[@name=Gender]:checked").val();var zip=$("#Zip").val();var height1=$("#Height_Ft").val();var height2=$("#Height_Inch").val();var height=height1+","+height2;var weight=$("#Weight").val();var weightGoal=$("#WeightGoal").val();var heartRate=$("#HeartRate").val();var birth1=$("#Birth_MM").val();var birth2=$("#Birth_DD").val();var birth3=$("#Birth_YY").val();var birth=birth3+"-"+birth1+"-"+birth2;var agree=$("#Agree").val();var scheck=$("#ScreenCheck").val();var scheckname=$("#ScreenName").val();var sname=((scheckname=='')?fname+" "+lname:scheckname);var criteria='';for(i=1;i<6;i++)
{if($('#Criteria'+i).attr("checked")==true)
{if(criteria!='')
criteria+=','+$('#Criteria'+i).val();else
criteria=$('#Criteria'+i).val();}}
if(uid!=''&&pwd!=''&&fname!=''&&lname!=''&&sex!=''&&zip!=''&&height1!=''&&height2!=''&&birth1!=''&&birth2!=''&&birth3!=''&&agree!=''&&(scheck!=''||scheckname!=''))
{$("#RegLoading").ajaxStart(function(){$(this).show();});$("#RegLoading").ajaxStop(function(){$(this).hide();});$.ajax({type:"POST",url:siteURL+"ajaxRequestEmail.php",data:"uid="+uid+"&pwd="+pwd+"&country="+$("#Country").val()+"&fname="+fname+"&lname="+lname+"&sname="+sname+"&sex="+sex+"&zip="+zip+"&height="+height+"&birth="+birth+"&type=email&Check="+$("input[@name=Check]:checked").val()+"&SpecialtyID="+$('#Specialty').val()+"&Desc="+$('#Desc').val()+"&Experience="+$('#Experience').val()+"&Price="+$('#Price').val()+"&Criteria="+criteria,success:function(msg){var msgresult=msg.split("||");if(msgresult[0]<1&&msgresult[1]==''){window.location=siteURL+"account.php";}else if(msgresult[0]<1&&msgresult[1]=='program'){window.location=msgresult[2];}else if(msgresult[0]<1&&msgresult[1]=='diet'){window.location=msgresult[2];}else if(msgresult[0]<1&&msgresult[1]=='payment'){window.location=siteURL+"paymentInfo.php";}else if(msgresult[2]!=''&&msgresult[2]!=undefined){window.location=siteURL+unescape(msgresult[2]);}
else
{if(msgresult[0]=='1'){$('#registerMsg').text('Email already exist. Please chose another.');}else{$('#registerMsg').text('Screen Name already exist. Please chose another.');}}}});return false;}}
function printit(){if(window.print)
{window.print();}}
$(document).ready(function(){$('input[@name=AccountType]').click(function(){$('#accounmsg').html('<span class="error_msg">Saving...</span>');$.ajax({type:"POST",url:"update.php",data:"AccountType="+$("input[@name=AccountType]:checked").val(),success:function(msg){$('#accounmsg').html('<span class="error_msg">Saved</span>');}});});});function SeeMore(id,total)
{var tid=document.getElementById('T'+id);var pid=document.getElementById('P'+id);var mid=document.getElementById('M'+id);var vid=document.getElementById('video'+id);if(tid.style.display=='none')
{tid.style.display='block';mid.style.display='block';pid.style.display='none';}
else
{tid.style.display='none';mid.style.display='none';pid.style.display='block';vid.style.display='none';}}
function SeeMoreDesc(id,total)
{var tid=document.getElementById('T'+id);var pid=document.getElementById('E'+id);var mid=document.getElementById('D'+id);var vid=document.getElementById('video'+id);if(tid.style.display=='none')
{tid.style.display='block';mid.style.display='block';pid.style.display='none';}
else
{tid.style.display='none';mid.style.display='none';pid.style.display='block';vid.style.display='none';}}
function showHide(id)
{for(i=1;i<6;i++)
{var idd=document.getElementById('M'+i);if(i==id)
{idd.style.display='block';}
else
{idd.style.display='none';}}}
function showMe(id,total,type)
{for(i=0;i<total;i++)
{idd=document.getElementById('sub'+type+i);if(idd)
{if(i==id)
{idd.style.display='block';}
else
{idd.style.display='none';}}}}
function joinEmuscle(id,type,ptype,url)
{$(document).ready(function(){var chkID=$("#joinnow").attr("id");var check=document.location.href;var arr=check.split('/');check=arr[arr.length-1];if(chkID=='joinnow')
{tb_show('Member Login',siteURL+'logIn.php?width=280&height=260','');var html=$.ajax({url:siteURL+"ajaxJoin.php",type:"POST",data:"id="+id+"&type="+type+"&ptype="+ptype+"&url="+url,async:false}).responseText;}
else
{if(ptype=='paid')
{var html=$.ajax({url:siteURL+"ajaxJoin.php",type:"POST",data:"id="+id+"&type="+type+"&ptype="+ptype+"&url="+url,async:false}).responseText;window.location.href=siteURL+'paymentInfo.php';}
else
{$("#searchResult").show();var html=$.ajax({url:siteURL+"ajaxJoin.php",type:"GET",data:"id="+id+"&type="+type+"&ptype="+ptype+"&url="+url,async:false}).responseText;if(html=='')
{window.location.href=url;}
else
{tb_show('Member Login',siteURL+'logIn.php?width=280&height=260','');}}}});}
function createProgram(type)
{$(document).ready(function(){tb_show('Member Login',siteURL+'logIn.php?width=280&height=260','');if(type=='exercise'){var html=$.ajax({url:siteURL+"ajaxJoin.php",type:"POST",data:"back=createExerciseProgram.php",async:false}).responseText;}else if(type=='diet'){var html=$.ajax({url:siteURL+"ajaxJoin.php",type:"POST",data:"back=createDietProgram.php",async:false}).responseText;}});}
var win_popup=null;function openWindow(url,name,params,w,h)
{var ah=window.availHeight;var aw=window.availWidth;var l=(aw-w)/2;var t=(ah-h)/2;params+=params==""?"":",";params+="left=0,top=0,height="+ah+",width="+aw;if(win_popup&&win_popup.open&&!win_popup.closed)
{win_popup.close();}
win_popup=window.open("",name,params);win_popup.location.href=siteURL+url;}
function MM_preloadImages(){var d=document;if(d.images){if(!d.MM_p)d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_preloadImages.arguments;for(i=0;i<a.length;i++)
if(a[i].indexOf("#")!=0){d.MM_p[j]=new Image;d.MM_p[j++].src=a[i];}}}
function MM_swapImgRestore(){var i,x,a=document.MM_sr;for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)x.src=x.oSrc;}
function MM_findObj(n,d){var p,i,x;if(!d)d=document;if((p=n.indexOf("?"))>0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}
if(!(x=d[n])&&d.all)x=d.all[n];for(i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=MM_findObj(n,d.layers[i].document);if(!x&&d.getElementById)x=d.getElementById(n);return x;}
function MM_swapImage(){var i,j=0,x,a=MM_swapImage.arguments;document.MM_sr=new Array;for(i=0;i<(a.length-2);i+=3)
if((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x;if(!x.oSrc)x.oSrc=x.src;x.src=a[i+2];}}