function createAjaxFn(){var xmlHttp;try{xmlHttp=new XMLHttpRequest();}catch(e){try{xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){alert("Your browser does not support AJAX!");return false;}}}
return xmlHttp;}
function getGiftAmount(month){var url="getgift_amount.php";xmlHttp2=createAjaxFn();if(xmlHttp2==null){alert("Browser does not support HTTP Request");return;}
var fee=document.getElementById('feeElement').value;var lanids=document.getElementById('lanidsElement').value;url=url+"?month="+month+"&fee="+fee+"&lanid="+lanids;xmlHttp2.onreadystatechange=function(){if(xmlHttp2.readyState==4){document.getElementById('price').innerHTML=xmlHttp2.responseText;}}
xmlHttp2.open("GET",url,true);xmlHttp2.send(null);}
function showdiv(val){if(val==0){document.getElementById('imperial').style.display='block';return true;}
if(val==1){document.getElementById('imperial').style.display='none';return true;}
return false;}
function showChangePassword(){document.getElementById('changePassword').style.display='block';document.getElementById('showChange1').style.display='block';document.getElementById('showChange2').style.display='none';document.getElementById('unsubscribePgm').style.display='none';document.getElementById('oldpass').value='';document.getElementById('newpass').value='';document.getElementById('confirmpass').value='';document.getElementById('showerror').innerHTML='';}
function UpdatePassword(){document.getElementById('changePassword').style.display='block';document.getElementById('showChange1').style.display='block';document.getElementById('showChange2').style.display='none';document.getElementById('showerror').style.visibility='hidden';document.getElementById('showerror').innerHTML='';var oldpass=document.getElementById('oldpass').value;var newpass=document.getElementById('newpass').value;var confirmpass=document.getElementById('confirmpass').value;xmlHttp3=createAjaxFn();if(xmlHttp3==null){alert("Browser does not support HTTP Request");return;}
url="change_password.php?oldpass="+oldpass+"&newpass="+newpass+"&confirmpass="+confirmpass;xmlHttp3.onreadystatechange=function(){if(xmlHttp3.readyState==4){if(xmlHttp3.responseText=="success"){document.getElementById('showChange2').style.display='block';document.getElementById('showerror').style.visibility='hidden';document.getElementById('showChange1').style.display='none';}else{document.getElementById('showerror').style.visibility='visible';document.getElementById('showerror').innerHTML=xmlHttp3.responseText;}}}
xmlHttp3.open("GET",url,true);xmlHttp3.send(null);}
function unsubscribe(){document.getElementById('unsubscribePgm').style.display='block';document.getElementById('changePassword').style.display='none';centerPopupMyProfileNew('unsubscribePgm');}
function centerPopupMyProfileNew(popupId){var popId=popupId;popupId="#"+popupId;var windowWidth=document.documentElement.clientWidth;var windowHeight=document.documentElement.clientHeight;var popupHeight=document.getElementById(popId).clientHeight;var popupWidth=document.getElementById(popId).clientWidth;$(popupId).css({"position":"fixed","top":windowHeight/2-popupHeight/2,"left":windowWidth/2-popupWidth/2});}
function hideUnsubscribe(styleid){document.getElementById(styleid).style.display='none';}
function hideUnsubscribemsg(styleid){document.getElementById(styleid).style.display='none';document.getElementById('new').style.display='block';document.getElementById('unsubmsg').style.display='none';}
function renewSubscriptionDisplay(){window.location="payment_renewal.php?origin=juser";}
function openNewWindow(URLtoOpen,windowName,width,height)
{windowFeatures="menubar=no,scrollbars=no,location=no,favorites=no,resizable=no,status=no,toolbar=no,directories=no";var test="'";winLeft=(screen.width-width)/2;winTop=(screen.height-(height+110))/2;window.open(URLtoOpen,windowName,"width="+width+",height="+height+",left="+winLeft+",top="+winTop+test+windowFeatures+test);}
function selectWorkout(curid,num,workoutflexid,workdate){if(curid=='b')
document.getElementById(curid+num).className='day_Orange1today';else
document.getElementById(curid+num).className='day_Orange1';if(curid=='a'){for(var i=1;i<=31;i++){if(i!=num){if(document.getElementById(curid+i)!=null)
document.getElementById(curid+i).className='day_Tick';}}
callToday();callOrange2();}
if(curid=='b'){for(var i=1;i<=31;i++){if(i!=num){if(document.getElementById(curid+i)!=null)
document.getElementById(curid+i).className='day_Today';}}
callTick();callOrange2();}
if(curid=='c'){for(var i=1;i<=31;i++){if(i!=num){if(document.getElementById(curid+i)!=null)
document.getElementById(curid+i).className='day_Orange2';}}
callTick();callToday();}}
function callOrange2(){for(var i=1;i<=31;i++){if(document.getElementById('c'+i)!=null)
document.getElementById('c'+i).className='day_Orange2';}}
function callTick(){for(var i=1;i<=31;i++){if(document.getElementById('a'+i)!=null)
document.getElementById('a'+i).className='day_Tick';}}
function callToday(){for(var i=1;i<=31;i++){if(document.getElementById('b'+i)!=null)
document.getElementById('b'+i).className='day_Today';}}
function showCommentSection(url){xmlHttpCmtSec=createAjaxFn();if(xmlHttp3==null){alert("Browser does not support HTTP Request");return;}
xmlHttpCmtSec.onreadystatechange=function(){if(xmlHttpCmtSec.readyState==4){document.getElementById('commentSecDiv').style.display="block";document.getElementById('commentSecDiv').innerHTML=xmlHttpCmtSec.responseText;}}
xmlHttpCmtSec.open("GET",url,true);xmlHttpCmtSec.send(null);}
function showProgram(workoutFlexId,pgmid,workoutOrder,workDate,workoutFlexId_cal){xmlHttp3=createAjaxFn();if(xmlHttp3==null){alert("Browser does not support HTTP Request");return;}
url="showProgram1.php?workFlex="+workoutFlexId+"&pgmid="+pgmid+"&workOrder="+workoutOrder+"&workDate="+workDate+"&workoutFlexId_cal="+workoutFlexId_cal;commentUrl="historicaCommentl_ajax.php?workFlex="+workoutFlexId+"&pgmid="+pgmid+"&workOrder="+workoutOrder+"&workDate="+workDate+"&workoutFlexId_cal="+workoutFlexId_cal;showCommentSection(commentUrl);xmlHttp3.onreadystatechange=function(){if(xmlHttp3.readyState==4){document.getElementById('produitLeftnew').style.display="block";document.getElementById('produitLeftnew').innerHTML=xmlHttp3.responseText;}}
xmlHttp3.open("GET",url,true);xmlHttp3.send(null);}
function showProgramEdit(workoutFlexId,pgmid,workoutOrder,workDate,workoutFlexId_cal,edit){xmlHttp3=createAjaxFn();if(xmlHttp3==null){alert("Browser does not support HTTP Request");return;}
url="showProgram1.php?workFlex="+workoutFlexId+"&pgmid="+pgmid+"&workOrder="+workoutOrder+"&workDate="+workDate+"&workoutFlexId_cal="+workoutFlexId_cal+"&feed="+feed;commentUrl="historicaCommentl_ajax.php?workFlex="+workoutFlexId+"&pgmid="+pgmid+"&workOrder="+workoutOrder+"&workDate="+workDate+"&workoutFlexId_cal="+workoutFlexId_cal+"&feed="+feed;showCommentSection(commentUrl);xmlHttp3.onreadystatechange=function(){if(xmlHttp3.readyState==4){document.getElementById('produitLeftnew').style.display="block";document.getElementById('produitLeftnew').innerHTML=xmlHttp3.responseText;}}
xmlHttp3.open("GET",url,true);xmlHttp3.send(null);}
function showEditComment(workoutFlex,pgmid,workoutOrder,work_date,work_Flex,feed){document.getElementById('updateComment').style.display="block";document.getElementById('mycommentsEdt').style.display="none";if(setRefSts("historypost")==1){document.getElementById("chkContainer").innerHTML=dataTpl;}
showProgramEdit(workoutFlex,pgmid,workoutOrder,work_date,work_Flex,feed);}
function addComment1(){var commentText=document.getElementById('comment_text1').value;var program_id=document.getElementById('program_id').value;commentText=commentText.replace(/^\s+|\s+$/g,'');program_id=program_id.replace(/^\s+|\s+$/g,'');if(program_id==""){alert("Please select program from calendar ");return false;}
if(commentText==""){alert("Please enter comment ");return false;}}
function addComment2(){var commentText=document.getElementById('comment_text2').value;commentText=commentText.replace(/^\s+|\s+$/g,'');if(commentText==""){alert("Please enter comment ");return false;}}
function unsetAllCat(){var i=0;for(i=0;i<catCount;i++){document.getElementById("catId_"+i).setAttribute("class","");document.getElementById("catId_"+i).className="";document.getElementById("catCntntHldr_"+i).style.display="none";}}
function selectCat(elementId){unsetAllCat();document.getElementById("catId_"+elementId).setAttribute("class","select");document.getElementById("catId_"+elementId).className="select";var jQryElId="#catId_"+elementId;document.getElementById("catCntntHldr_"+elementId).style.display="block";}
function hideErormeage(err)
{if(err==2)
window.location.href="payment_renew.php";else
window.location.href="userArea.php?actn=cGF5bWVudFN1Y2Nlc3M=";}
function validate(lanId)
{var checkSelected=false;var radios=document['plan'].elements['payment_plan'];for(var i=0;i<radios.length;i++)
{if(radios[i].checked)
{checkSelected=true;}}
if(!checkSelected)
{if(lanId=='1')
alert("Please Enter Your Payment Plan.");else if(lanId=='2')
alert("S'il vous plaît Entrez votre plan de paiement.");else if(lanId=='3')
alert("Por favor ingrese su plan de pago.");else
alert("Inserisci la tua Piano di Pagamento.");return(false);}
if((document.getElementById('cardno').value=="")&&(document.getElementById('switch').value=="2"))
{if(lanId=='1')
alert("Please Enter Your Card Number.");else if(lanId=='2')
alert("Veuillez insérer votre numéro de carte.");else if(lanId=='3')
alert("Por favor, introduzca su número de tarjeta.");else
alert("Si prega di inserire il vostro numero di carta.");return false;}
if((document.getElementById('cvv').value=="")&&(document.getElementById('switch').value=="2"))
{if(lanId=='1')
alert("Please Enter Your CVV Number.");else if(lanId=='2')
alert("Veuillez  insérer les 3 derniers chiffres au dos de votre carte (+ display the pciture of the CVV NUMber).");else if(lanId=='3')
alert("Veuillez insérer les 3 derniers chiffres au dos de votre carte (+ mostrar el pciture del número CVV).");else
alert("Veuillez insérer les 3 Derniers chiffres au dos de votre carte (+ visualizzare il pciture del numero CVV).");return false;}
return true;}
function validatePaymentNew(lanId)
{var checkSelected=false;var radios=document['plan'].elements['payment_plan'];for(var i=0;i<radios.length;i++)
{if(radios[i].checked)
{checkSelected=true;}}
if(!checkSelected)
{if(lanId=='1')
showAlert("paymantAlertMsg","alertMsgPayment","Please Enter Your Payment Plan.");else if(lanId=='2')
showAlert("paymantAlertMsg","alertMsgPayment","S'il vous plaît Entrez votre plan de paiement.");else if(lanId=='3')
showAlert("paymantAlertMsg","alertMsgPayment","Por favor ingrese su plan de pago.");else
showAlert("paymantAlertMsg","alertMsgPayment","Inserisci la tua Piano di Pagamento.");return(false);}
if((document.getElementById('cardno').value=="")&&(document.getElementById('switch').value=="2"))
{if(lanId=='1')
showAlert("paymantAlertMsg","alertMsgPayment","Please Enter Your Card Number.");else if(lanId=='2')
showAlert("paymantAlertMsg","alertMsgPayment","Veuillez insérer votre numéro de carte.");else if(lanId=='3')
showAlert("paymantAlertMsg","alertMsgPayment","Por favor, introduzca su número de tarjeta.");else
showAlert("paymantAlertMsg","alertMsgPayment","Si prega di inserire il vostro numero di carta.");return false;}
if((document.getElementById('cvv').value=="")&&(document.getElementById('switch').value=="2"))
{if(lanId=='1')
showAlert("paymantAlertMsg","alertMsgPayment","Please Enter Your CVV Number. <br /> <p align='center'><img src='images/crypto.jpg'></p>");else if(lanId=='2')
showAlert("paymantAlertMsg","alertMsgPayment","Veuillez  insérer les 3 derniers chiffres au dos de votre carte. <br /> <p align='center'><img src='images/crypto.jpg'></p>");else if(lanId=='3')
showAlert("paymantAlertMsg","alertMsgPayment","Veuillez insérer les 3 derniers chiffres au dos de votre carte. <br /> <p align='center'><img src='images/crypto.jpg'></p>");else
showAlert("paymantAlertMsg","alertMsgPayment","Veuillez insérer les 3 Derniers chiffres au dos de votre carte. <br /> <p align='center'><img src='images/crypto.jpg'></p>");return false;}
return true;}
function showAlert(containerId,elementId,msgContent){document.getElementById(elementId).innerHTML=msgContent;showPopup(containerId,"");}
function unsubscribe(){document.getElementById('unsubscribePgm').style.display='block';centerPopupMyProfileNew('unsubscribePgm');}
function hideUnsubscribe(styleid){document.getElementById(styleid).style.display='none';}
function showDiscountPopup(){document.getElementById("renewSubscriptionId").style.display='block';centerPopupDiscount('renewSubscriptionId');}
function centerPopupDiscount(popupId){var popId=popupId;popupId="#"+popupId;var windowWidth=document.documentElement.clientWidth;var windowHeight=document.documentElement.clientHeight;var popupHeight=document.getElementById(popId).clientHeight;var popupWidth=document.getElementById(popId).clientWidth;$(popupId).css({"position":"fixed","top":windowHeight/2-popupHeight/2,"left":windowWidth/2-popupWidth/2});}
function renewSubscriptionDisplay(){document.getElementById("renewSubscriptionId").style.display='none';}
var popupStatusGeneral=0;function showPopup(popupId,backGroundId){popupId="#"+popupId;if(backGroundId!=""){backGroundId="#"+backGroundId;}
centerPopupGeneral(popupId,backGroundId);loadPopupGeneral(popupId,backGroundId);}
function loadPopupGeneral(popupId,backGroundId){if(popupStatusGeneral==0){if(backGroundId!=""){$(backGroundId).css({"opacity":"0.7"});$(backGroundId).fadeIn("slow");}
$(popupId).fadeIn("slow");popupStatusGeneral=1;}}
function disablePopupGeneral(popupId,backGroundId){popupId="#"+popupId;if(popupStatusGeneral==1){if(backGroundId!=""){$(backGroundId).fadeOut("slow");}
$(popupId).fadeOut("slow");popupStatusGeneral=0;}}
function centerPopupGeneral(popupId,backGroundId){var windowWidth=document.documentElement.clientWidth;var windowHeight=document.documentElement.clientHeight;var popupHeight=$(popupId).height();var popupWidth=$(popupId).width();$(popupId).css({"position":"fixed","top":windowHeight/2-popupHeight/2,"left":windowWidth/2-popupWidth/2});}
