// JavaScript Document naeem bhatt naeembhatti@gmail.com function theDate() { dat = new Date(); month = dat.getMonth(); monthname = new Array(); monthname[0] = "January"; monthname[1] = "February"; monthname[2] = "March"; monthname[3] = "April"; monthname[4] = "May"; monthname[5] = "June"; monthname[6] = "July"; monthname[7] = "August"; monthname[8] = "September"; monthname[9] = "October"; monthname[10] = "November"; monthname[11] = "December"; day = dat.getDate(); if (day == 1) {dayadd = "st";} else if (day == 21) {dayadd = "st";} else if (day == 31) {dayadd = "st";} else if (day == 2) {dayadd = "nd";} else if (day == 22) {dayadd = "nd";} else if (day == 3) {dayadd = "rd";} else if (day == 23) {dayadd = "rd";} else {dayadd = "th";} year = dat.getFullYear(); document.write ('' + monthname[month] + ' ' + day + '' + dayadd + ', ' + year + ''); } function navOn(idName) { if (document.getElementById(idName)) { document.getElementById(idName).className="on"; } } function navOff(idName) { if (document.getElementById(idName)) { document.getElementById(idName).className="off"; } } //================================= function replace(string,text,by) { // Replaces text with by in string var strLength = string.length, txtLength = text.length; if ((strLength == 0) || (txtLength == 0)) return string; var i = string.indexOf(text); if ((!i) && (text != string.substring(0,txtLength))) return string; if (i == -1) return string; var newstr = string.substring(0,i) + by; if (i+txtLength < strLength) newstr += replace(string.substring(i+txtLength,strLength),text,by); return newstr; } /* var testString = '1,2,3,4,5,5'; alert('Before: ' + testString); testString = replace(replace(testString,',','@'),',','@'); alert('After: ' + testString);*/ function showForm_through() { if(document.getElementById){ document.getElementById('d_rb').innerHTML='
';} } var site; function submitForm_through() { document.ifhForm.submit(); } //to remove html tags function stripHTML(){ var re= /<\S[^><]*>/g for (i=0; iPlease enter your email.",'NewsLetterEmailError'); document.NewsLetterForm.NewsLetterEmail.focus(); return false; }else if (echeck(document.NewsLetterForm.NewsLetterEmail.value)==false) { show_error("Invalid email.",'NewsLetterEmailError'); document.NewsLetterForm.NewsLetterEmail.focus(); return false; } else { open_window('SubscribeToNewsLetter.php?email='+document.NewsLetterForm.NewsLetterEmail.value); return false; } } function checkfield() { var myflage=true; if(document.registration_form.user_name.value=='') { show_error("Pleae enter your username ",'div_user_name'); myflage=false; }else{ check_user_name('check_user_name.php?user_name='+document.registration_form.user_name.value); // alert(document.registration_form.naeem.value); if(document.registration_form.naeem.value==1){ myflage=false; } // alert(newtext); hide_error('div_user_name'); } // for email if(document.registration_form.txt_email.value=='') { show_error("Please enter your email.",'div_email'); myflage=false; } else if(document.registration_form.txt_email.value!='') { if (echeck(document.registration_form.txt_email.value)==false) { show_error("Invalid email.",'div_email'); myflage=false; } else { // check_email('check_email.php?email='+document.registration_form.txt_email.value); if(document.registration_form.temp.value==1){ myflage=false; } hide_error('div_email'); } } //for re-type email if((document.registration_form.txt_email.value!='')&&(document.registration_form.txt_email.value!=document.registration_form.txt_email_confirm.value)){ show_error("We’re sorry, emails do not match.",'div_email_confirm'); myflage=false; }else{ hide_error('div_email_confirm'); } //for password if(document.registration_form.txt_password.value==''){ show_error("Pleae enter your password.",'div_password'); myflage=false; }else if(document.registration_form.txt_password.value.length<6){ show_error("Passwords should be minimum of 6 characters",'div_password'); myflage=false; }else{ hide_error('div_password'); } //agree if(document.registration_form.agree.checked == false){ show_error("Please read the Terms of Use and check the box to indicate your acceptance.",'div_agree'); myflage=false; }else{ hide_error('div_agree'); } //if all errors true if(myflage==true){ document.registration_form.submit(); } }//end form=========================================================================================== function makeObject() { var x; var browser = navigator.appName; //detect the client browser if(browser == "Microsoft Internet Explorer"){ x = new ActiveXObject("Microsoft.XMLHTTP"); }else{ x = new XMLHttpRequest(); } return x; } //call the function makeObject() var request = makeObject(); var new_request = makeObject(); var rate_request = makeObject(); var group_request = makeObject(); var request_interest = makeObject(); var request_linked_profile = makeObject(); var request_requested_deals = makeObject(); //function send request function CheckAvailUser(url){ if(document.registration_form.UserName.value==''){ show_error('Username is empty!','CheckUserMsg'); }else{ hide_error('ExecuteErrorUserName'); hide_error('CheckUserMsg'); document.getElementById('CheckUser').style.display = "block"; request.open('POST', url); request.onreadystatechange = function () { if (request.readyState == 4) { responsestring = request.responseText; var msg = responsestring.split("="); if (msg[1] == 'sorry') { document.getElementById('CheckUser').style.display = "none"; show_error('We’re sorry it’s already taken.','CheckUserMsg'); }else { document.getElementById('CheckUser').style.display = "none"; show_error('Available.','CheckUserMsg'); } } } request.send(''); } } //function send request function CheckAvailEmail(url){ if(document.registration_form.UserEmail.value==''){ show_error('Email is empty!','CheckEmailMsg'); }else if (echeck(document.registration_form.UserEmail.value)==false) { show_error("Invalid email.",'CheckEmailMsg'); }else{ hide_error('ExecuteErrorEmail'); hide_error('CheckEmailMsg'); document.getElementById('CheckEmail').style.display = "block"; request.open('POST', url); request.onreadystatechange = function () { if (request.readyState == 4) { responsestring = request.responseText; var msg = responsestring.split("="); if (msg[1] == 'sorry') { document.getElementById('CheckEmail').style.display = "none"; show_error('We’re sorry it’s already taken.','CheckEmailMsg'); }else { document.getElementById('CheckEmail').style.display = "none"; show_error('Available.','CheckEmailMsg'); } } } request.send(''); } } function CheckAllFields() { var ReturnValue = true; if(document.registration_form.UserName.value==''){ show_error('Username is empty!','CheckUserMsg'); ReturnValue = false; }else{ hide_error('CheckUserMsg'); } if(document.registration_form.UserEmail.value==''){ show_error('Email is empty!','CheckEmailMsg'); ReturnValue = false; }else if (echeck(document.registration_form.UserEmail.value)==false) { show_error("Invalid email.",'CheckEmailMsg'); ReturnValue = false; }else{ hide_error('CheckEmailMsg'); } if(document.registration_form.UserPassword.value==''){ show_error('Password is empty!','CheckPassMsg'); ReturnValue = false; }else{ hide_error('CheckPassMsg'); } if((document.registration_form.UserPasswordConfirm.value!=document.registration_form.UserPassword.value)&&(document.registration_form.UserPassword.value!='')){ show_error('Confirm Your Password.','CheckPassConfMsg'); ReturnValue = false; }else{ hide_error('CheckPassConfMsg'); } return ReturnValue; } function ValidateForm() { var ReturnValue = true; var l_CountryNameSelection = document.getElementById('Country').options[document.getElementById('Country').selectedIndex].text; if(document.registration_form.Name.value==''){ show_error('Name is empty!','CheckUserMsg'); ReturnValue = false; }else{ hide_error('CheckUserMsg'); } if(document.registration_form.Email.value==''){ show_error('Email is empty!','CheckEmailMsg'); ReturnValue = false; }else if (echeck(document.registration_form.Email.value)==false) { show_error("Invalid email.",'CheckEmailMsg'); ReturnValue = false; }else{ hide_error('CheckEmailMsg'); } if(document.registration_form.Company.value==''){ show_error('Company is empty!','CheckCompanyMsg'); ReturnValue = false; }else{ hide_error('CheckCompanyMsg'); } if(l_CountryNameSelection=='(Select a Country)'){ show_error('Country is empty!','CheckDeliveryCountryMsg'); ReturnValue = false; }else{ hide_error('CheckDeliveryCountryMsg'); } if(document.registration_form.Phone.value==''){ show_error('Business Phone is empty!','CheckPhoneMsg'); ReturnValue = false; }else{ hide_error('CheckPhoneMsg'); } //alert(document.registration_form.DeliveryCountry.value+'@@'); /*if(document.registration_form.DeliveryCountry.value==''){ show_error('Country is empty!','CheckDeliveryCountryMsg'); ReturnValue = false; }else{ hide_error('CheckDeliveryCountryMsg'); }*/ return ReturnValue; } //end tags========================================================================================= function NumericCheck(fl) { var checkOK = "0123456789."; var checkStr; var allValid; var decPoints; var allNum; checkStr = fl allValid = true; decPoints = 0; allNum = ""; for (k = 0; k < checkStr.length; k++) { ch = checkStr.charAt(k); for (l = 0; l < checkOK.length; l++) if (ch == checkOK.charAt(l)) break; if (l == checkOK.length) { allValid = false; break; } if (ch != ",") allNum += ch; } if (!allValid) { // alert("Please enter only digit characters in the \"Numeric\" field."); return (false); } return (true); } function PlayAudio(file) { window.open('PlayAudio.php?file='+file,"mywindow","menubar=1,resizable=1,width=440,height=190,location=0"); } function DownloadFile(file) { //alert(file); window.open('DownloadFile.php?file='+file,"mywindow","menubar=1,resizable=1,width=440,height=190,location=0"); } function PlayVideo(file) { //alert(file); window.open('PlayVideo.php?file='+file,"mywindow","menubar=1,resizable=1,width=440,height=390,location=0"); } //open pop up============================================== function open_window(page){ window.open (page, "dealarmy", "location=0,status=1,menubar=no,resizable=yes,scrollbars=1"); } //random image display================================================== var img_rnd = new Array("images/011 BANER 9X3.JPG", "images/002 BANER 9X3.JPG", "images/003 BANER 9X3.JPG", "images/004 BANER 9X3.JPG", "images/005 BANER 9X3.JPG", "images/006 BANER 9X3.JPG", "images/007 BANER 9X3.JPG", "images/008 BANER 9X3.JPG", "images/009 BANER 9X3.JPG", "images/010 BANER 9X3.JPG", "images/011 BANER 9X3.JPG" ); var i = Math.round(4*Math.random()); var img_rnd = new Array("images/011 BANER 9X3.JPG", "images/002 BANER 9X3.JPG", "images/003 BANER 9X3.JPG", "images/004 BANER 9X3.JPG", "images/005 BANER 9X3.JPG", "images/006 BANER 9X3.JPG", "images/007 BANER 9X3.JPG", "images/008 BANER 9X3.JPG", "images/009 BANER 9X3.JPG", "images/010 BANER 9X3.JPG", "images/011 BANER 9X3.JPG" ); var i = Math.round(4*Math.random()); /*function check() { var img_name = new Array("images/011 BANER 9X3.JPG", "images/002 BANER 9X3.JPG", "images/003 BANER 9X3.JPG", "images/004 BANER 9X3.JPG", "images/005 BANER 9X3.JPG", "images/006 BANER 9X3.JPG", "images/007 BANER 9X3.JPG", "images/008 BANER 9X3.JPG", "images/009 BANER 9X3.JPG", "images/010 BANER 9X3.JPG", "images/011 BANER 9X3.JPG" ); var l = img_name.length; var rnd_no = Math.round((l-1)*Math.random()); document.r_img.src = img_name[rnd_no]; }*/