﻿ var http_request=true;function loading(warntagID)
{document.getElementById(warntagID).style.display='block';document.getElementById(warntagID).innerHTML='<div class="block_page"></div>';}
function makePOSTRequest(url,parameters){http_request=false;if(window.XMLHttpRequest){http_request=new XMLHttpRequest();if(http_request.overrideMimeType){http_request.overrideMimeType('text/html');}}else if(window.ActiveXObject){try{http_request=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
if(!http_request){alert('Cannot create XMLHTTP instance');return false;}
http_request.onreadystatechange=alertContents;http_request.open('POST',url,true);http_request.setRequestHeader("Content-type","application/x-www-form-urlencoded");http_request.setRequestHeader("Content-length",parameters.length);http_request.setRequestHeader("Connection","close");http_request.send(parameters);}
function alertContents(){if(http_request.readyState==4){if(http_request.status==200){result=http_request.responseText;document.getElementById("warnTag").style.display='block';document.getElementById("warnTag").innerHTML=result;}else{alert('متاسفانه در درخواست مشکلی رخ داده است.');}}}
function getPoller(obj){var poststr="&text="+encodeURI(document.getElementById("text").value)+"&whereID="+encodeURI(document.getElementById("whereID").value)+"&where="+encodeURI(document.getElementById("where").value)+"&send_poller="+encodeURI(document.getElementById("send_poller").value);makePOSTRequest(PATH+"ajax.php?noheader=true",poststr);}
function getLoginCheck(obj){var poststr="&login_username="+encodeURI(document.getElementById("login_username").value)+"&login_password="+encodeURI(document.getElementById("login_password").value)+"&login_submit="+encodeURI(document.getElementById("login_submit").value);makePOSTRequest(PATH+"ajax.php?noheader=true",poststr);}
function getForgetCheck(obj){var poststr="&email="+encodeURI(document.getElementById("email").value)+"&forget_submit="+encodeURI(document.getElementById("forget_submit").value);makePOSTRequest(PATH+"ajax.php?noheader=true",poststr);}
function getSignupCheck(obj){var poststr="&continentList="+encodeURI(document.getElementById("continentList").value)+"&countryList="+encodeURI(document.getElementById("countryList").value)+"&username="+encodeURI(document.getElementById("username").value)+"&password="+encodeURI(document.getElementById("password").value)+"&retype_pass="+encodeURI(document.getElementById("retype_pass").value)+"&email="+encodeURI(document.getElementById("email").value)+"&capt="+encodeURI(document.getElementById("capt").value)+"&signup_submit="+encodeURI(document.getElementById("signup_submit").value);makePOSTRequest(PATH+"ajax.php?noheader=true",poststr);}
function deleteOtherSessions_attached_Check(obj){var poststr="&deleteOtherSessions_attached="+encodeURI(document.getElementById("deleteOtherSessions_attached").value);makePOSTRequest(PATH+"ajax.php?noheader=true",poststr);}
function getAdminLoginCheck(obj){var poststr="&username="+encodeURI(document.getElementById("username").value)+"&password="+encodeURI(document.getElementById("password").value)+"&adm_login_submit="+encodeURI(document.getElementById("adm_login_submit").value);makePOSTRequest(PATH+"ajax.php?noheader=true",poststr);}
function getPurchaseProduct(obj){var poststr="&product="+encodeURI(document.getElementById("product").value)+"&purchaseProduct="+encodeURI(document.getElementById("purchaseProduct").value);makePOSTRequest('../inc/modules/ajax_post.php',poststr);}