﻿function Invited(iBoosterID)
{
     $.get(encodeURI("AjaxHandler.aspx?itype=1&iBoosterID="+ iBoosterID +"&iAdID=" + $("#LblAdID").attr("innerHTML") +"&Message="+$("#txtMessage").attr("innerHTML") +"&"+ Math.floor(Math.random()*1000)),function(data){
          if(data==0)
          {$("#hdscore_"+iBoosterID).attr("value","1");//$("#txtMessage").attr("innerHTML")
          alert("Success!")}
          else
          {alert("Failed!");}
              });
}
function ajaxboostingstatus(boostedAdID,status)
{
    $("#bloom_"+boostedAdID).attr("innerHTML","<img src='/images/loading.gif' alt='' />");
     $.get(encodeURI("AjaxHandler.aspx?itype=3&id="+ boostedAdID+"&status="+status+"&"+ Math.floor(Math.random()*1000)),function(data){
      if(data!=0)
            $("#bloom_"+boostedAdID).attr("innerHTML",data);
      });
}

function UpdateAdStatus(iADid,ioldstatus,inewstatus)
{
    $("#boostr_"+iADid).attr("innerHTML","<img src='/images/loading.gif' alt='' />");
    $.get("AjaxHandler.aspx?itype=4&ID="+iADid+"&newstatus="+inewstatus+"&oldstatus="+ioldstatus+"&ran=" + Math.floor(Math.random()*1000),function(data){
            $("#boostr_"+iADid).attr("innerHTML",data);
            if(inewstatus==-1)
                $("#operate_"+iADid).css("display","none");
    }); 
}
function UpdateAdType(iADid,ioldtype,inewtype)
{
    $("#type_"+iADid).attr("innerHTML","<img src='/images/loading.gif' alt='' />");
    $.get("AjaxHandler.aspx?itype=5&ID="+iADid+"&newtype="+inewtype+"&oldtype="+ioldtype+"&ran" + Math.floor(Math.random()*1000),function(data){
            $("#type_"+iADid).attr("innerHTML",data);
    }); 
}
function AdvUpdateBoostingStatus(iBoostingID,ioldstatus,inewstatus)
{
    $("#bloom_"+iBoostingID).attr("innerHTML","<img src='/images/loading.gif' alt='' />");
    
    $.get("AjaxHandler.aspx?itype=6&ID="+iBoostingID+"&newstatus="+inewstatus+"&oldstatus="+ioldstatus+"&ran=" + Math.floor(Math.random()*1000),function(data){
            $("#bloom_"+iBoostingID).attr("innerHTML",data);
    }); 
}
function BoosterUpdateBoostingStatus(iBoostingID,ioldstatus,inewstatus)
{
    $("#bloom_"+iBoostingID).attr("innerHTML","<img src='/images/loading.gif' alt='' />");
    $.get("AjaxHandler.aspx?itype=2&ID="+iBoostingID+"&newstatus="+inewstatus+"&oldstatus="+ioldstatus+"&ran=" + Math.floor(Math.random()*1000),function(data){
            $("#bloom_"+iBoostingID).attr("innerHTML",data);
    }); 
}

function advertManage(iADid,istatus)
{
    var status = -1;
    if(istatus=='active')
        status = 1;
    else if(istatus =='inactive')
        status = 0;
    else if(istatus =='public')
        status = 10;
    else if(istatus =='private')
        status = 11;
    if(status>=10)
        $("#type_"+iADid).attr("innerHTML","<img src='/images/loading.gif' alt='' />");
    else
        $("#boostr_"+iADid).attr("innerHTML","<img src='/images/loading.gif' alt='' />");
   $.get("AjaxHandler.aspx?itype=2&ID="+iADid+"&Status="+status+"&" + Math.floor(Math.random()*1000),function(data){
        if(status>=10)
            $("#type_"+iADid).attr("innerHTML",data);
        else
            $("#boostr_"+iADid).attr("innerHTML",data);
    }); 
    if(status==-1)
        $("$operate_"+iADid).css("display","none"); 
}
function ajaxboostingrqad(objID,iADid,istatus)
{
    var status = 1;
    if(istatus=='active')
        status = 1;
    else if(istatus =='inactive')
        status = 0;
    else if(istatus =='public')
        status = 10;
    else if(istatus =='private')
        status = 11;
    if(status>=10)
        $("#type_"+objID).attr("innerHTML","<img src='/images/loading.gif' alt='' />");
    else
        $("#boostr_"+objID).attr("innerHTML","<img src='/images/loading.gif' alt='' />");
        
   $.get("AjaxadvertManage.aspx?ID="+iADid+"&Status="+status+"&" + Math.floor(Math.random()*1000),function(data){
        if(status>=10)
        {
            $("#type_"+objID).empty(); 
            $("#type_"+objID).append(data); 
        }
        else
        {
            $("#boostr_"+objID).empty(); 
            $("#boostr_"+objID).append(data); 
        }
    }); 
}
function ajaxscore(boostedAdID,score)
{
  if(confirm("Are you sure to give him " +score+" stars right ?"))
       {
          $.get(encodeURI("AjaxHandler.aspx?itype=7&iBoostedAdID="+ boostedAdID+"&iStar="+score+"&"+ Math.floor(Math.random()*1000)),function(data){
          if(data==1)
          {
            var radioitems=document.getElementById("score_"+boostedAdID).getElementsByTagName("input");
            for (var i=0; i<radioitems.length; i++)
				radioitems[i].setAttribute("disabled",true);	
            alert("Success!");
          }
          else
            alert("failure!");
          });
       } 
}


function bannerManage(iID,istatus)
{

    var status = -1;
    if(istatus==0)
        status = 1;
    else if(istatus==1)
        status = 0;
   $.get("AjaxbannerMange.aspx?ID="+iID+"&status="+status+"&" + Math.floor(Math.random()*1000),function(data){
        $("#status_"+iID).empty(); 
        $("#status_"+iID).append(data); 
    }); 
    if(status==-1)
        document.getElementById("operate_"+iID).style.display = "none"; 
}


function Approve(Index,iBoostedAdID,Boostistatus)
{
   var objLblStutas;
   objLblStutas=$("#LblStutas").attr("innerHTML");
   var objtxtMessage;
   objtxtMessage=document.getElementById("txt"+Index).value;
   $.get("/sp/AjaxAdBoostingStatus.aspx?BoostAdID="+iBoostedAdID+"&sMessage="+objtxtMessage+"&Boostistatus="+Boostistatus+"&Status="+objLblStutas+"&" + Math.floor(Math.random()*1000),function(data){
        $("#operate_"+Index).empty(); 
        $("#operate_"+Index).append(data); 
    }); 
    document.getElementById("Dv_"+Index).style.display="none";
    document.getElementById("txt"+Index).value="";
    objLblStutas="";
}

function ShowHddnDiv(ID,istatus)
{
    var id = "";
    if(document.getElementById("hdID")!=undefined)
        id = document.getElementById("hdID").value;
        
    document.getElementById("hdID").value = ID;
      
    if(id!=ID) 
    {
        if(id!="")
            document.getElementById(id).style.display="none"; 
        document.getElementById(ID).style.display = "";
    }
    else 
    {
        if(document.getElementById(ID).style.display == "")
            document.getElementById(ID).style.display = "none";
        else
            document.getElementById(ID).style.display = "";
    }
    id=document.getElementById("LblStutas").innerText=istatus;
}

function updateRecommend(iID,iBooster,Rating,Type)
{        
    if(Type==1)
    {
        var Message = document.getElementById('Mrecommend_'+iID).value;
       $.get("Ajaxactive.aspx?boostid="+iBooster+"&message="+Message+"&Rating="+Rating+"&" + Math.floor(Math.random()*1000),function(data){
            
        }); 
        document.getElementById('Mrecommend_'+iID).value="";
        document.getElementById('Drecommend_'+iID).style.display="none";
    }
    else if(Type==2)
    {
        var Message = document.getElementById('Mrecommend2_'+iID).value;
      $.get("Ajaxactive.aspx?boostid="+iBooster+"&message="+Message+"&Rating="+Rating+"&" + Math.floor(Math.random()*1000),function(data){
            
        }); 
        document.getElementById('Mrecommend2_'+iID).value="";
        document.getElementById('Drecommend2_'+iID).style.display="none";
    }
}
function ShowHiddenDiv(ID)
{
    var id = "";
    if(document.getElementById("hdID")!=undefined)
        id = document.getElementById("hdID").value;
        
    document.getElementById("hdID").value = ID;
        
    if(id!=ID) 
    {
        if(id!="")
            document.getElementById(id).style.display="none"; 
        document.getElementById(ID).style.display = "";
    }
    else 
    {
        if(document.getElementById(ID).style.display == "")
            document.getElementById(ID).style.display = "none";
        else
            document.getElementById(ID).style.display = "";
    }
}

function AddAdToList(iAdID)
{
    
        $('#' + iAdID + 'SaveProcess').html("<img src='/images/button/processing2.gif' style='vertical-align:middle' >");
    
        $.get("/sp/boost/addlist.aspx?iAdID="+iAdID+"&" + Math.floor(Math.random()*1000),function(data){ 
                 if(data==1)
                 {
                        if($("#inpRecordNum").val()!="")
                        { 
                           $("#inpRecordNum").attr("value",parseInt($("#inpRecordNum").val())+1);
                           $("#litRecordNum").attr("value","My Saved Ads: <a href='/sp/booster/boost/adv/bstSaveAds.aspx' >" + $("#inpRecordNum").val() + "</a>");
                        }
                        else
                        {
                           $("#inpRecordNum").attr("value",1); 
                           $("#litRecordNum").attr("value","My Saved Ads: <a href='/sp/booster/boost/adv/bstSaveAds.aspx' >1</a>"); 
                         } 
                    $('#' + iAdID + 'SaveProcess').html("saved");
                  }
                 else {
                     if(data==0)
                        alert('This ad is already in your list!');
                     else if(data==-2)
                        alert('You need to be a booster to add this ad to your list.!');
                     else
                        alert('Fail to add this ad to your list!');
                        
                    $('#' + iAdID + 'SaveProcess').html("");
                 }
            }); 
    
}

function RemoveAdFromMyList(iAdID)
{
    if(confirm('Are you true to Remove ?'))
    {
        $.get("/sp/boost/Ajaxremovead.aspx?iAdID="+iAdID+"&" + Math.floor(Math.random()*1000),function(data){ 
                 if(data==1)
                    alert('Remove success!');
                 else
                    alert('Remove fail!');
            }); 
    }
}
function UpdateRole(objID,iRole,ioperatetype)
{
    if(ioperatetype==0)
        ioperatetype=-1;//stop operate
    else if(ioperatetype==-1||ioperatetype==-10)
        ioperatetype=0;//apply operate
    else if(ioperatetype=-100)
        ioperatetype=-10;//delete operate
    if(confirm('Are you true ?'))
    {
        $.get("/admin/sp/Ajax/Ajaxupdaterole.aspx?objID="+objID+"&Role="+iRole +"&operatetype="+ioperatetype+"&ran="+ Math.floor(Math.random()*1000),function(data){ 
                 if(data==1)
                 {
                    if(ioperatetype==-10)
                        document.getElementById("div_"+objID).style.display="none";
                    alert('operate success!');
                 }
                 else
                    alert('operate fail!');
            }); 
    }
}


function AdserverSignIn(id,Pwd,objId)
{
      var objTxtId=document.getElementById(id);
      var objTxtPwd=document.getElementById(Pwd);
      
      var iUserID=document.getElementById("Hdn1").value;
      $.get("/Adserver/AjaxSignIn.aspx?id="+objTxtId.value+"&Pwd="+objTxtPwd.value+"&iUserID="+iUserID+"&" + Math.floor(Math.random()*1000),function(data){
      if(data==1)
      {
         objTxtId=document.getElementById(objId);
         objTxtId.style.display = "block";
         alert('Successful landing');
         createTable(null,null);
      }
      else
      {
         alert('Landing failure');
      }
//        $("#operate_"+Index).empty(); 
//        $("#operate_"+Index).append(data); 
    });
}

function AdserverThickboxSignIn(id,Pwd,objId,objIdEidt)
{
      var objTxtId=document.getElementById(id);
      var objTxtPwd=document.getElementById(Pwd);
      var iUserID=document.getElementById("LblUesrID").value;
      $.get("/Adserver/AjaxSignIn.aspx?id="+objTxtId.value+"&Pwd="+objTxtPwd.value+"&iUserID="+iUserID+"&" + Math.floor(Math.random()*1000),function(data){
      if(data==1)
      {
         objTxtId=document.getElementById(objId);
         objTxtId.style.display = "none";
         objTxtId=document.getElementById(objIdEidt);
         objTxtId.style.display = "block";
//         createTable(null,null);
      }
      else
      {
         alert('Landing failure');
      }
//        $("#operate_"+Index).empty(); 
//        $("#operate_"+Index).append(data); 
    });
}


function AdserverEidtJsCode(ClientID,iDigit,iAdNo,iPosition,sKeyword,sUrl,iSearch,iCategory)
{ 
       $.get("/Adserver/AjaxEidtJsCode.aspx?ClientID="+ClientID+"&iDigit="+iDigit+"&iAdNo="+iAdNo+"&iPosition="+iPosition+"&sKeyword=" +sKeyword 
      +"&sUrl=" +sUrl +"&iSearch=" +iSearch +"&iCategory=" +iCategory  +"&" + Math.floor(Math.random()*1000),function(data){
      if(data==1)
      {
         alert('Update successful');
         window.parent.document.getElementById("Reollie_ad_iframe_id").contentWindow.location.reload();
//         form1.submit();
      }
      else
      {
         alert('Update failed');
      }
    });
}


function AdserverThickEidtJsCode(objAdNo,objPosition,objKeyword,objCategory,objId,objColor)
{ 
      var iAdNo=document.getElementById(objAdNo).options[document.getElementById(objAdNo).options.selectedIndex].value; 
      var iPosition=document.getElementById(objPosition).options[document.getElementById(objPosition).options.selectedIndex].value; 
      var iCategory=document.getElementById(objCategory).options[document.getElementById(objCategory).options.selectedIndex].value; 
      var sKeyword=document.getElementById(objKeyword).value;
      var objColorId=document.getElementById(objColor);
      var valColor=objColorId.value;
      var iSearch=0;
      var mPlayer=new Array();
      valmPlayer=document.getElementById("lblPram").innerHTML;
      mPlayer=valmPlayer.split('|.-|');
      $.get("/Adserver/AjaxEidtJsCode.aspx?ClientID="+mPlayer[5]+"&iDigit="+mPlayer[3]+"&iAdNo="+iAdNo+"&iPosition="+iPosition+"&sKeyword=" +sKeyword 
      +"&sUrl=" +mPlayer[6] +"&iSearch=" +iSearch+"&sCorol=" +valColor.replace("#","%23")  +"&iCategory=" +iCategory +"&" + Math.floor(Math.random()*1000),function(data){
      if(data==1)
      {
//         alert('Update successful');
         parent.Reollie_ad_remove();
         window.parent.document.getElementById("Reollie_ad_iframe_id").contentWindow.location.reload(); 
      }
      else
      {
         alert('Update failed');
      }
    });
}


function fakeadclickimpression(iAdID,iBoostedAdID,iAdvertiserID,iBoosterID,iPublisherID,iPageID,iAdPlayerID,sIP)
{ 
      $.get("/Adserver/AjAxShineAd.aspx?iAdID="+iAdID+"&iBoostedAdID="+iBoostedAdID+"&iAdvertiserID="+iAdvertiserID+"&iBoosterID="+iBoosterID+"&iPublisherID="+iPublisherID 
      +"&iPageID="+iPageID+"&iAdPlayerID="+iAdPlayerID+"&sIP="+sIP+"&" + Math.floor(Math.random()*1000),function(data){
      });
}

function funflag(valID,objID,valbflag)
{ 
      $.get("AjAxMessage.aspx?iID="+valID+"&" + Math.floor(Math.random()*1000),function(data){
      if(data==1)
      {
         var objBflag=document.getElementById(valbflag);
         if(objID.src.indexOf("/images/sign_g.gif",0)>0)
            objID.src="/images/sign.gif";
         else
            objID.src="/images/sign_g.gif"; 
      }
      else
      {
       alert("Set marked the failure of!");
      }
      });
}


function funVerification(valID,objUserName,objPwd,iUserID,objUrl,bflag)
{ 
      sUserName=document.getElementById(objUserName).value;
      sPwd=document.getElementById(objPwd).value;
      sUrl=document.getElementById(objUrl).value;
      $.get("Verification.aspx?iID="+valID+"&sUserName=" +sUserName+"&sPwd=" +sPwd +"&iUserID=" +iUserID +"&sUrl=" +sUrl +"&bflag=" +bflag +"&"+ Math.floor(Math.random()*1000),function(data){
      if(data==1)
      {
         alert("Proved to be successful!");
         document.getElementById("divcheckID").style.display="none";
         var objDivQuery= document.getElementById("DivQueryCover")
         objDivQuery.className= "DivQueryHidden"; 
      }
      else
      {
        alert("Authentication failure!");
      }
      });
}

function funProducedJsCode(iID,url)
{ 
    if(/^\s*$/.test(url)) 
       return;   
    else
    {   
       url=url.toLowerCase();
       if(url.substr(0,7)=="http://")
         url=url.substr(7,url.length);
       var vIndex=-1;  
       vIndex=url.indexOf(".com/profiles",0);
       if(vIndex!=-1)
       {
          url=url.substr(0,vIndex); 
          url=url.substr(4,url.length);
          alert(url);
          return;
       }
       vIndex=url.indexOf(".com",0);
       if(vIndex!=-1)
          url=url.substr(0,vIndex); 
       if(url=="twitter")
       {
          window.location.href=encodeURI("/app/twitter/Verification.aspx");
           return;
       }
       if(url=="profiles.yahoo")
       {
            alert(url);
            return;
       }
       if(url.substr(0,4)=="www.")
         url=url.substr(4,url.length);    
       switch(url)
       {
        case "facebook":
             window.location.href=encodeURI("/app/twitter/welcome.aspx");
        break;
        
        case "myspace":
             window.location.href=encodeURI("/app/myspace/welcome.aspx");
        break;
        
        case "twitter":
             window.location.href=encodeURI("/app/twitter/Verification.aspx");
        break;
        
        case "linkedin":
          alert(url);
        break;
        
        default:
          $.get("AjAXVerification.aspx?iID="+ iID +"&"+ Math.floor(Math.random()*1000),function(data){
          if(data!=0)
          {
             var objDivQuery;
             var divcheckID;
             divcheckID=document.getElementById("divJsCodeID");
             objDivQuery= document.getElementById("DivQueryCover")
             
             if(divcheckID.className == "DivQueryHidden")
	        {
		        divcheckID.className="DivQueryDisplay"; 
		        objDivQuery.className="DivQueryBlock";
		        divcheckID.style.left = document.body.offsetWidth/2-230+"px";
		        divcheckID.style.top = window.screen.height/2-300+"px";
		        objDivQuery.style.height = document.body.offsetHeight+"px";
	        }
            
             
              var  objtxtID=document.getElementById("txtcheckID");
              var valJsCode="<script language=\"javascript\">";
              valJsCode= valJsCode+"Reollie_ad_ID="+iID+";";
              valJsCode= valJsCode+"Reollie_ad_VerificationCode="+data+";";
              valJsCode= valJsCode+"</script>";
              valJsCode= valJsCode+"<script language=\"javascript\" src=\"http://www.reollie.com/js/JVerifyJSCode.js\"></script> ";
              objtxtID.value=valJsCode;
          }
          else
          {
            alert("failure!");
          }
          }); 
        break;
       }    
    } 
}

function funMergerAccount(sUserName,sPassWord,sAppUrlName,bflag)
{  
  if(bflag=="1" && sUserName=="0")
  {
     alert("Account do not need to merge!");
     return;
  }
  $.get(encodeURI("AjAxMergerAccount.aspx?sUserName="+ sUserName +"&sPassWord="+sPassWord+"&sAppUrlName="+sAppUrlName+"&bflag="+bflag+"&"+ Math.floor(Math.random()*1000)),function(data){
  if(data==1)
  {
    alert("Success!");
  } 
  else
  {
    alert(data);
    alert("failure!");
  }
  }); 
}

function AdvScore(iBoostedAdID ,iStar)
{
  if($("#Lblstar").attr("innerHTML")=="0")
  {
      if(confirm("Are you sure to give him " +iStar.toString()+" stars right ?"))
           {
              $.get(encodeURI("AjaxHandler.aspx?itype=7&iBoostedAdID="+ $("#"+iBoostedAdID).attr("innerHTML")+"&iStar="+iStar+"&"+ Math.floor(Math.random()*1000)),function(data){
              if(data==1)
              {
                var i=1;
                while(i<=iStar)
                {
                   $("#star"+i.toString()).attr("src","/images/sign.gif")
                   i=i+1;
                }
                document.getElementById("Lblstar").innerHTML=data.toString();
                alert("Success!"); 
              }
              else if(data==2)
                alert("Comments have been over!");
              else
                alert("failure!");
              });
           } 
   }
}


function AdInvited(iBoosterID,iAdID)
{
    
   $.get(encodeURI("/sp/adv/camp/AjaxadMatched.aspx?iBoosterID="+ iBoosterID +"&iAdID=" + iAdID +"&Message="+$("#txtMessage").attr("innerHTML") +"&"+ Math.floor(Math.random()*1000)),function(data){
   if(data==0)
   {$("#hdscore_"+iBoosterID).attr("value","1");//$("#txtMessage").attr("innerHTML")
    alert("Success!")}
   else
   {alert("failure!");} });
}

function nenMsgAll()
{
    var msgs = $("#taAllMsg").attr("value");
    if(/^\s*$/.test(msgs))
    {
        alert("Please enter your messages !"); 
        return false;
    }
    $.post("/sp/adv/camp/booster/AjaxnewMsgAll.aspx?ran="+ Math.floor(Math.random()*1000),{msg:msgs},function(data){if(data==0){alert("Success!")}else{alert("failure!");}});
}

function CreateCode(iID,iBoostingStyle,iAdSize,iAdWidth,iAdHeight,iCategory,itemplateId,bLocalAd,bSocialType,sbgColor,sName,bBorder,iBorder,skeyword)
{
   $.get(encodeURI("/sp/pub/player/AjAxJsCode.aspx?iBoostStyle="+iBoostingStyle +"&iID=" + iID +"&iAdSize=" + iAdSize +"&LocalAd=" + bLocalAd 
   +"&templateId=" + itemplateId+"&Category=" + iCategory +"&bSocialType=" + bSocialType +"&sbgColor=" + escape(sbgColor) +
   "&sName=" + escape(sName) + "&bBorder=" + bBorder + "&iBorder=" + iBorder + "&skeyword=" + escape(skeyword)  + "&"+ Math.floor(Math.random()*1000)),function(data){
   if(data>0 )
   {
            var strSource= "";
            strSource += "<script language=\"javascript\">\n";
            strSource += "Reollie_ad_BoostStyle=" + iBoostingStyle + ";\n";
            strSource += "Reollie_ad_PlayerId=" + data.toString() + ";\n";
            strSource += "Reollie_ad_width=" + iAdWidth+ ";\n";
            strSource += "Reollie_ad_height=" + iAdHeight + ";\n";
            strSource += "<\/script\>\n";
            strSource += "<script language=\"javascript\" ";
            strSource += "src=\"http://www.reollie.com/Adserver/js/Pub_ad.js\"><\/script\> ";
            $('#JsCodeId').attr("value",strSource);
            
            if($("#divQueryCond").attr("class")== "DivQueryHidden")
		    {
			        $("#divQueryCond").attr("class", "DivQueryDisplay");
			        $("#DivQueryCover").attr("class", "DivQueryBlock");
			        $("#divQueryCond").css("left", document.body.offsetWidth/2-200+"px");
			        $("#divQueryCond").css("top", "100px");
			        $("#DivQueryCover").css("height", document.body.offsetHeight+"px");
		    }
    }
   else if(data==0)
   alert("failure!");
   else alert("Already exists in the size of the!");
    });
}

function DelCode(iID)
{
   $.get("/sp/pub/player/AjAxDelCode.aspx?iID=" + iID + "&"+ Math.floor(Math.random()*1000),function(data){
   if(data==0 )
   {
        $("#"+iID).css("display","none");  
        alert("Success!");
   }
   else alert("failure!");});
}

function UpdateBusinessinfo(sSiteDescription,iGender,iAge)
{
   $.get("/sp/pub/AjAxtargetting.aspx?sSiteDescription=" + sSiteDescription +"&iGender=" + iGender +"&iAge=" + iAge + "&"+ Math.floor(Math.random()*1000),function(data){
   if(data==0) alert("Success!");
   else alert("failure!");});
}
function feedback(type,msg,sForm,flag)
{
 $.get("/help/AjaxContact.aspx?&type="+type+"&msg="+msg+"&sForm="+sForm+"&flag="+flag+"&ran=" + Math.floor(Math.random()*1000),function(data){
 if(data==1) {alert("Your message is recerived. We will contact you soon!"); $("#tbMsg").attr("value","");$("#tbEmail").attr("value","");} else alert("Oops. Something is wrong. Please try again; Or you can contact us at contact@reollie.com"); }); 
}

function checkVeriCode(obj)
{ 
    var sVerifiredCode=$("#"+obj).attr("value");
    var msg = new Array("tbVeriCode","Please enter the verifired code.","the Verifired Code is emply.","The asd verifired code is not correct.");
    if(/^\s*$/.test(sVerifiredCode))
    {
      $("#tbVeriCode_Error").empty();
      $("#tbVeriCode_Error").append(msg[1]);
      return false;
    }
   $.get("/secure/AjAxVerifired.aspx?Verifired="+sVerifiredCode+"&ran=" + Math.floor(Math.random()*1000),
   function(data){
      if(data!=1) {
                 $("#tab_tbVeriCode").attr("class","reg_select_err_tr");
                 $("#tbVeriCode_Error").empty();
                 $("#tbVeriCode_Error").append(msg[3]);
                 $("#tbVeriCode_Error").attr("class","reg_tr_info_error");
            }
      else  {
        $("#tbVeriCode_Error").attr("check","1");
        $("#tbVeriCode_Error").empty();
        $("#tab_tbVeriCode").attr("class","");
        $("#tbVeriCode_Error").attr("class","");
        $("#hidVeriCode").attr("value", sVerifiredCode);
        $("#" + obj).attr("check", "1");
        }
        
     }); 
}
