function createIndustryType(value)
{ 
  if(value!=""){
    if(value!='Other') {
        var doc = CreateAjaxObject();
        doc.open("GET","http://192.168.1.240/gotxt/gotxt/sms_registereds/industry_type/"+value,false);
        doc.send(null);       
        var Res = doc.responseText;
        document.getElementById('industry_type').innerHTML =  Res;
    } else {
        document.getElementById('industry_type').innerHTML =  "Type industry type in box here <input type='text' name='data[SmsRegistered][job_title]' id='ind_type' maxlength='25'/>";
    }  
  } else {
        document.getElementById('industry_type').innerHTML =  "";
  }
  
}
function findnewaddress(){
	postcode=document.getElementById("postcode").value;
	if(postcode==''){
	  alert("Please enter POST CODE");
	  document.getElementById("postcode").focus();
	  return false;
	}
	else {
	   var doc = CreateAjaxObject();
	   var url="http://www.google.co.in";
	   doc.open("GET",url,false);
	   doc.send(null);
	   var Res=doc.responseText;
	   alert(Res);

	}

}
function searchyr(yourresponse_server_path){
	postcode=document.getElementById("postcode").value;
	if(document.getElementById("first_name").value==''){
		first_name="0";
	}
	else {
		first_name=document.getElementById("first_name").value;
	}
	if(document.getElementById("last_name").value==''){
		last_name="0";
	}
	else {
		last_name=document.getElementById("last_name").value;
	}
	if(document.getElementById("company_name").value==''){
		company_name="0";
	}
	else {
		company_name=document.getElementById("company_name").value;
	}

	if(document.getElementById("job_title").value==''){
		job_title="0";
	}
	else {
		job_title=document.getElementById("job_title").value;
	}
	if(document.getElementById("address_line_1").value==''){
		address_line_1="0";
	}
	else {
		address_line_1=document.getElementById("address_line_1").value;
	}
	if(document.getElementById("address_line_2").value==''){
		address_line_2="0";
	}
	else {
		address_line_2=document.getElementById("address_line_2").value;
	}
	if(document.getElementById("address_line_3").value==''){
		address_line_3="0";
	}
	else{
		address_line_3=document.getElementById("address_line_3").value;
	}
	if(document.getElementById("town").value==''){
		town="0";
	}
	else {
		town=document.getElementById("town").value;
	}
	if(document.getElementById("county").value==''){
		county="0";
	}
	else{
		county=document.getElementById("county").value;
	}
	if(document.getElementById("country").value==''){
		country="0";
	}
	else{
		country=document.getElementById("country").value;
	}

	if(postcode==''){
	  alert("Please enter POST CODE");
	  document.getElementById("postcode").focus();
	  return false;
	}else {
	window.open(yourresponse_server_path+"/sms_registereds/reset_passowords/"+first_name+"/"+last_name+"/"+company_name+"/"+job_title+"/"+address_line_1+"/"+address_line_2+"/"+address_line_3+"/"+town+"/"+county+"/"+country+"/"+postcode+"/0","","Width=600,height=600,scrollbars=yes");
	}
}
function CreateAjaxObject()
{
  var doc = null;
  if (typeof window.ActiveXObject != 'undefined' )
  {
     doc = new ActiveXObject("Microsoft.XMLHTTP");
  }
  else
  {
     doc = new XMLHttpRequest();
  }           
  return doc;       
  
} 

function validateIntermediate1Form(frmObj,e,server_path) {
  
   var alt = false;
   if(document['OrderInquiryIntermediate_1']['keyword'].length>1) {
     for(var i=0;i<document['OrderInquiryIntermediate_1']['keyword'].length;i++) {
       if(document['OrderInquiryIntermediate_1']['keyword'][i].value=="" || document['OrderInquiryIntermediate_1']['keyword'][i].value==" ") {
         var alt = true;
       } else {
         var alt = false;break;
       }
     }
     if(alt) { alert("Please type atleast one keyword"); return false;}  
   } else {
     if(document['OrderInquiryIntermediate_1']['keyword'].value=="")
     {
       alert("Please type atleast one keyword");
       document['OrderInquiryIntermediate_1']['keyword'].focus();
       return false; 
     }      
   }
  
  var num_loop = document['OrderInquiryIntermediate_1']['keyword'].length;
  var doc = CreateAjaxObject();
  var keywords = "";  
  var j=0;
  old_kewd = true;
  var chk_ahead = true;
  //chkUniqueKeywords(document['OrderInquiryIntermediate_1']['keyword']);  
  for(var i=0;i<num_loop;i++) {
    if(document['OrderInquiryIntermediate_1']['keyword'][i].value!="")
    {
      keyword = document['OrderInquiryIntermediate_1']['keyword'][i].value;
      old_kewd = chkUniqueKeywords(document['OrderInquiryIntermediate_1']['keyword'] , keyword);
      if(old_kewd) {
        doc.open("GET",server_path + "online_inquiry/KeywordExist/"+keyword,false);
        doc.send(null);       
        var Res = doc.responseText;
        var info = Res.split("@@");
      
        if(info[0]==0) {
            j++;
            keywords += " ["+j+"] " + keyword+"\n"; 
        }
        old_kewd=keyword;
      } else {
        keywords += "You have selected the following broucher that is already in your basket";
        keywords +="\n\n[1] "+keyword+"";
        keywords +="\n\nOnly copy of a broucher may be in your basket at any one time.";
        chk_ahead = false;
        break;
      }  
    }
          
  }
  if(chk_ahead) {
    if(keywords!="") {
         keywords += "\nThe keyword(s) you have selected are not available.\nPlease resubmit your keyword and press submit.";
    }
  }   
  
  if(keywords=="") {  
     //alert(frmObj.name);
     //document.getElementById(frmObj.name).submit();
     frmObj.submit();     
  }
  else { 
     alert(keywords);
     return false;
  }
  
  var key_exist = document.getElementById('keyword_exist_validate');
  var keys = key_exist.value.split(",");

  if(keys.length > 0) {
    var msg = "";
    for(var i=0;i<keys.length;i++) {
        msg += " ["+(i+1)+"] "+ document['OrderInquiryIntermediate_1']['keyword'][keys[i]].value;
        msg +="\n";  
    }
    msg +="\n";  
    msg +="These keyword(s) are not available";
    alert(msg);return false;
  }  else {
     return true;
  }
  return false;    
}

function chkUniqueKeywords(kewds , curr_keywd)
{
   num_loop = kewds.length;
   var err = true;
   var count=0; 
   for(var i=0;i<num_loop;i++) {
      if(curr_keywd == kewds[i].value)
      {
        count++;
      }
   }
   if(count>1)
   err = false;
   
   return err;      
}

function removeTextFromBox(_id,flag)
{
    if(flag == "remove") {
        var ObjElement = document.getElementById(_id);
        if(_id == "pwd") {
          ObjElement.type="password";          
        }
      
        //alert(ObjElement.type);
        if(ObjElement.value =="TYPE EMAIL OR MOBILE" || ObjElement.value =="TYPE PASSWORD")
        {
            ObjElement.value="";
        } 
    }
    else {
        var ObjElement = document.getElementById(_id);
        if(ObjElement.value =="")
        {
            if(_id == "email_or_mobile") {
              ObjElement.value="TYPE EMAIL OR MOBILE";
            }
            else {
              ObjElement.type="text";
              ObjElement.value="TYPE PASSWORD";
            }
        }
    }
}

function validateForm(frmObj)
{
   sub = true;
   /*if(frmObj.security_answer.value=="") {
     alert("Security answer can not be null");
     frmObj.security_answer.focus();
     sub = false;
   } */
   
   if(frmObj.email_or_mobile.value=="" || frmObj.email_or_mobile.value=="TYPE EMAIL OR MOBILE") {
     alert("Please complete your mobile number or email address to continue");
     sub = false;
     return false;
   }
   
   if(frmObj.password.value=="" || frmObj.password.value=="TYPE PASSWORD") {
     alert("Please complete your mobile number or email address and password to continue.\n\nIf this continues to fail please request another password by email or text.");
     sub = false;
     return false;
   }
   
   if(sub) {
     if(!frmObj.chk_remember_me.checked) {
        var flg = confirm("Would you like to save your settings to this computer to speed up your enquiry next time?");
        if(flg==true) {
            frmObj.save_data.value="on";
        } else {
            frmObj.save_data.value="off";
        }
        frmObj.submit();
     } else {
       frmObj.submit();
     }
   } else {
     return false;
   }
    
      
  /* if(frmObj.mobile_no.value=="") {
     alert("Phone number can not be null");
     frmObj.mobile_no.focus();
     return false;
   }
   else {
     var alt_no = validateNo(frmObj.mobile_no.value);
     if(!alt_no) {
        alert("Phone number is not valid");
        frmObj.mobile_no.focus();
        return false;
     }
   }
   
   
   if(trim(frmObj.email_address.value,'')=="") {
     alert("Email address can not be null");
     frmObj.email_address.focus();
     return false;
   }
   else
   {
     var val_email = validateEmail(trim(frmObj.email_address.value,''));
     if(!val_email) {
        alert("Email address is not valid");
        frmObj.email_address.focus();
        return false;
     } 
   }
   */ 
   /*
   if(frmObj.security_question.value=="") {
     alert("Security question can not be null");
     frmObj.security_question.focus();
     return false;
   } */
   
  
  
}

function validateNo(phone_no)
{
   var valid_no = "+-0123456789";
   if(phone_no.length<11) {
     return false;
   }  
   for(var i=0;i<phone_no.length;i++) {
    var fg = valid_no.indexOf(phone_no[i]);
      if(fg == -1) {
        var alt = false;
      } else { var alt = true; } 
   }
   return alt;
   
}

function validateEmail(elementValue){
  var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/; 
  return emailPattern.test(elementValue); 
} 

function MM_findObj(n, d) { //v4.01
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;
}

var count=6;
function addRowToTable(rows,server_path)
{
        Objtbl = document.getElementById("tbl");
        //tbl = MM_findObj("tbl");
        //alert(tbl);return false;
        var lastRow = Objtbl.rows.length-1;
        var iteration = lastRow+1;
               
        var row = Objtbl.insertRow(iteration);
        var cell0 = row.insertCell(0);
        cell0.align = 'left';
        cell0.vAlign = 'top';
        var textNode0 = document.createTextNode("Keyword-"+(count+1) +":");
        cell0.appendChild(textNode0);        
        
        var cell1 = row.insertCell(1);
        cell1.align='left';
        var input1 = document.createElement("input");
        input1.setAttribute('type', 'text');
        input1.name="keyword[]";
        //input1.size='45';
        input1.id='keyword';
        input1.onblur = function() { checkKeywordExist(this.value,server_path,div.id,c_div.id) };
        cell1.appendChild(input1); 
        
        var cell2 = row.insertCell(2);
        cell2.align='left';
        cell2.vAlign='top';
        var c_div = document.createElement("div");
        c_div.id = "client_"+(count+1);
        c_div.style.display ='none';
        c_div.style.height='3px';
        cell2.appendChild(c_div);
                
        var div = document.createElement("div");
        div.id = "error_msg_"+(count+1);
        div.style.display ='none';
        div.style.height='3px';
        cell1.appendChild(div);
        
        count++;
        
        //input1.onblur = function() { checkKeywordExist(this.value,server_path,"error_msg_"+(count+1)) };
        //cell1.appendChild(input1);
      //  did = "error_msg_"+(count+1);
        
        
        //var row1 = tbl.insertRow((iteration+1));
        //var cell2 = row1.insertCell(0);
        //cell2.align='left';
        //cell2.colSpan='2';
        //var div = document.createElement("div");
        //div.id = "error_msg_"+(count+1);
        //div.style.display ='none';
        
        //cell2.appendChild(div);
        
        
        
        
    

}

function checkKeywordExist_backup(keyword,server_path,div_id) {
   var str = new String(div_id);
   var new_str= parseInt(str.substring(str.lastIndexOf("_")+1,str.length));
   var new_str = new_str - 1;
   //alert(str.substring(div_id.length,div_id.lastIndexOf("_"));
   if(keyword != "") {
        
        var doc = CreateAjaxObject();
        doc.open("GET",server_path + "online_inquiry/KeywordExist/"+keyword,false);
        doc.send(null);       
        var Res = doc.responseText;
        var objDiv = document.getElementById(div_id);
        var key_exist = document.getElementById('keyword_exist_validate');
        
        if(Res == 0) {
            objDiv.innerHTML = "<font color='#FF0000'><strong>This keyword is not exist</strong></font>";
            if(key_exist.value=='none') {
               key_exist.value = new_str;
            }
            else {
              remove_keys  =  key_exist.value.split(",");
             
              for(var i=0;i<remove_keys.length;i++) {
                //alert(remove_keys[i]);
                if(new_str!=remove_keys[i]) {
                   attach = true;continue;
                }  else { attach = false;break; }
                
              }
              if(attach) {
                 key_exist.value = key_exist.value +","+ new_str;
              }
            }  
                        
        } else {
            objDiv.innerHTML = "<font color='#00FF00'><strong>This keyword is available</strong></font>";
            var remove_keys = new Array();
            //var keys="none";
            if(key_exist.value!="none") {
               remove_keys  =  key_exist.value.split(",");
               key_exist.value=""; 
               for(var i=0;i<remove_keys.length;i++) {
                 if(new_str==remove_keys[i]) {
                   attach = false;
                } else { attach = true; }
                
                if(attach) {
                   if(i==0) {
                     key_exist.value +=  remove_keys[i]; 
                   }
                   else {
                     key_exist.value = key_exist.value + remove_keys[i] + ",";
                   }
                }
                
              }
              //key_exist.value = keys;
            }
        }
   } else {
          var objDiv = document.getElementById(div_id);
          var key_exist = document.getElementById('keyword_exist_validate');  
          
          if(objDiv.innerHTML!="") {
            objDiv.innerHTML = "";              
          }  
          
          /*var remove_keys = new Array();
          remove_keys = key_exist.value.split(",");
          if(remove_keys.length ==1) {
            //if(remove_keys[0]=="none")
              key_exist.value = "none";
            //else
              //key_exist.value = remove_keys[0];  
          
          }*/ 
          
   }    
}

function checkKeywordExist(keyword,server_path,div_id,client_div_id) {
   
   var objDiv = document.getElementById(div_id);
   var objClientDiv = document.getElementById(client_div_id);
   //keyword = trim(keyword,'');
   //alert(keyword);return false;
   if(keyword != "") { 
      var doc = CreateAjaxObject();
      doc.open("GET",server_path + "online_inquiry/KeywordExist/"+keyword,false);
      doc.send(null);       
      var Res = doc.responseText
      var info = Res.split("@@");
      if(info[0] == 0) {
            objDiv.style.display ='block';
            //objDiv.innerHTML = "<img src='/gotxt/gotxt/img/close.jpeg' width='20' height='20'></img><font color='#FF0000' size='1'><strong>This keyword is not available please enter another one</strong></font>";
            objDiv.innerHTML = "<img src='"+server_path+"/img/close.jpeg' width='20' height='20' align='top'></img>&nbsp;<font color='#FF0000' size='1'><strong>This keyword is not available please enter another one</strong></font>";
       } else {
            //objDiv.innerHTML = "<img src='/gotxt/gotxt/img/checkbox.jpeg' width='20' height='20'></img><font color='#00CC00' size='1'><strong>This keyword is available</strong></font>";
            objDiv.innerHTML = "<img src='"+server_path+"/img/checkbox.jpeg' width='20' height='20' align='bottom'></img>&nbsp;<font color='#00CC00' size='1'><strong>This keyword is available</strong></font>";
            objDiv.style.display = 'block';
            
            objClientDiv.innerHTML ="<font color='#000000' size='2'><strong>"+info[1]+"</strong></font>";
            objClientDiv.style.display ='block';
            
       }     
   } else {
       if(objDiv.innerHTML!="") {
           objDiv.style.display = 'none';
           objDiv.innerHTML = "";              
       }    
   }   
}

var t = 0;
var d_id;
function showPHFee(callee,div_id) {
        if(t) {
            clearTimeout(t);
        }
        d_id = div_id;
        var alertMessage = new String();
        
        //PHFeeBoxMessage = "MasterCard, Visa, Visa Electron and Amex:<br />4 EUR / 3 GBP / 15 PLN / 1050 HUF / 38 SEK / 15 RON / 32 NOK / 8 BGN / 31 UAH<br />Diners:<br />10 EUR / 7.5 GBP / 36 PLN / 2600 HUF / 94 SEK / 37 RON / 80 NOK / 20 BGN / 78 UAH<br />Switch, Solo and Maestro:<br />1,5 GBP<br />";
        alertMessage = "<div class='bd'><table border='0' align='center' width='100%'><tr><td width='90%'><strong>Frequently asked questions</strong></td><td align='center'><a onclick='hidePHFee();' style='cursor:pointer;'>X</a></td></tr><tr><td colspan='2'><strong>Q. What is gotxt?</strong></td></tr><tr><td colspan='2'>A. If you want a free, fast, safe and simple way to get the literature you want without the hassle of filling out forms every time just complete <strong>one form</strong> online with gotxt.</td></tr><tr><td colspan='2'>&nbsp;</td></tr><tr><td colspan='2'><strong>Q. How does gotxt work?</strong></td></tr><tr><td colspan='2'>Once gotxt knows your address, whenever you see displayed on ads in magazines or on TV and want further details, simply type the advertisement code into your mobile or PC and you will receive the information by post/email, entirely FREE.</td></tr><tr><td colspan='2'>First time users simply register their preferred delivery details online selecting post, email or both.</td></tr><tr><td colspan='2'>It's as easy as that!</td></tr><tr><td colspan='2'>&nbsp;</td></tr><tr><td colspan='2'><strong>Q. How do gotxt members benefit?</strong></td></tr><tr><td colspan='2'>A. gotxt members can respond to marketing material at anytime even when UK offices are closed and receive instant information by email/post<br/><br/>A. gotxt remembers your name and address every time you want information<br/><br/> A. gotxt let's you know where your nearest stockist is located instantly<br/><br/>A. gotxt let's you know that your information is on its way<br/><br/>A. gotxt is convenient<br/><br/>          A. gotxt is fast<br/><br/>A. gotxt is easy<br/><br/>          A. gotxt is immediate          <br/><br/>         A. gotxt protects your mobile from unwanted spam<br/><br/>          A. gotxt is simple</td></tr><tr><td colspan='2'>&nbsp;</td></tr><tr><td colspan='2'><strong>Q. How will gotxt members be able to get the information they need using gotxt?</strong></td></tr><tr><td colspan='2'>A. Mobile phone<br/><br/>            A. gotxt is launching an online version soon which will enable you to get instant advertiser information from your PC/MAC</td></tr><tr><td colspan='2'>&nbsp;</td></tr><tr><td colspan='2'><strong>Q. How will gotxt be displayed on company marketing material?</strong></td></tr><tr><td colspan='2'>A. See examples of how gotxt is promoted <a href='http://gotxt.biz/ad_examples.pdf'>http://gotxt.biz/ad_examples.pdf</a></td></tr><tr><td colspan='2'>&nbsp;</td></tr><tr><td colspan='2'><strong>Q. Where am I likely to see gotxt displayed?</strong></td></tr><tr><td colspan='2'>A. On printed magazine advertisements, direct mail literature, posters, television, exhibition stand, exhibition show guide, invitations and even on manufacturers web sites</td></tr><tr><td colspan='2'>&nbsp;</td></tr><tr><td colspan='2'><strong>Q. What happens after I send a TEXT/SMS message?</strong></td></tr><tr><td colspan='2'>A. You will receive a text reply confirming your literature/information is on its way. If you have also registered your email address you will receive a notification email with links to the advertisers web site.</td></tr><tr><td colspan='2'>&nbsp;</td></tr><tr><td colspan='2'><strong>Q. What is the total cost per text enquiry?</strong></td></tr><tr><td colspan='2'>A. gotxt is FREE of charge</td></tr></table></div>";
        nd = document.getElementById(div_id);
       
        nd.className='PHFeeBox';
        var dim = findPos(document.getElementById(callee));
        nd.style.top = dim+30+"px";
        nd.style.left = 450+"px";
        //nd.style.left = dim[1]-190+"px";
        nd.style.display = '';
        nd.innerHTML = alertMessage;
        t = setTimeout("hidePHFee()",120000);
    }
    
    function hidePHFee() {
    nd = document.getElementById(d_id);
    nd.style.display = 'none';
}

function findPos(obj) {
    var curleft = curtop = 0;
    if (obj.offsetParent) {
        curleft = obj.offsetLeft
        curtop = obj.offsetTop
        while (obj = obj.offsetParent) {
            curleft += obj.offsetLeft
            curtop += obj.offsetTop
        }
    }
    return curtop;
}

function trim(str, chars) {
return ltrim(rtrim(str, chars), chars);
}

function ltrim(str, chars) {
chars = chars || '\\s';
return str.replace(new RegExp("^[" + chars + "]+", "g"), "");
}

function rtrim(str, chars) {
chars = chars || '\\s';
return str.replace(new RegExp("[" + chars + "]+$", "g"), "");
}
function createBoxForQuestion(value)
{
  var ObjSecQuestion = document.getElementById("other_secuirty_question");
  if(value=='other') {
    ObjSecQuestion.style.display='block';
  } else {
    ObjSecQuestion.style.display='none';
  }
}

function validateEmailAddress(frmObj)
{
   var sub = true;
   if(frmObj.email_address.value=="" && frmObj.phone_no.value=="") {
     alert("Email address OR Phone-no can not be null");
     sub = false;
     return false;
   } 
  
   if(frmObj.email_address.value!="" && frmObj.phone_no.value!="") 
   {
     alert("Type email address OR type phone-no not both");
     sub = false;
     return false;
   }  
   
   if(frmObj.email_address.value!="") {
     var val_email = validateEmail(frmObj.email_address.value);
     if(!val_email) {
        alert("Email address is not valid");
        frmObj.email_address.focus();
        sub = false;
        return false;
     }
     frmObj.step.value = 'proceed_email';
   }
   
   if(frmObj.phone_no.value!="") {
     frmObj.step.value = 'proceed_sms';
   }
   
   if(sub) {
     frmObj.submit();  
   } else {
     return false; 
   }
   
}

function validateEmailAddressPhone_step2_2(frmObj)
{
   var sub = true;
   if(frmObj.email_address.value=="" && frmObj.phone_no.value=="") {
     alert("Email address OR Phone-no can not be null");
     sub = false;
     return false;
   } 
   
   if(frmObj.email_address.value!="") {
     var val_email = validateEmail(frmObj.email_address.value);
     if(!val_email) {
        alert("Email address is not valid");
        frmObj.email_address.focus();
        sub = false;
        return false;
     }
   }
   
   if(sub) {
     frmObj.submit();  
   } else {
     return false; 
   }
   
}

function validatePhoneNoRetrive(frmObj) {
  var sub = true;
  
  if(frmObj.phone_no.value=="") {
     alert("Phone-no can not be null");
     sub = false;
     return false;
  }
  
  
  if(frmObj.phone_no.value.substr(0,1)!=0) {
     alert("Include zero(0) e.g 07788888888");
     sub = false;
     return false;
  }
  
  if(sub) {
    frmObj.step.value = "proceed_sms";
    frmObj.submit(); 
  } else {
    return false;
  }
       
}
function validateEmailRetrive(frmObj) {
  var sub = true;
  
  if(frmObj.email_address.value=="") {
     alert("Email address can not be null");
     sub = false;
     return false;
  }
  
  if(frmObj.email_address.value!="") {
     var val_email = validateEmail(frmObj.email_address.value);
     if(!val_email) {
        alert("Email address is not valid");
        frmObj.email_address.focus();
        sub = false;
        return false;
     }
  }
  
  if(sub) {
    frmObj.step.value = "proceed_email";
    frmObj.submit(); 
  } else {
    return false;
  }
       
}

function open_wnd(url) {
  window.open(url);
}

function selectIssue(server_path,issue_id,publication) {
 //alert(server_path);
  var frmObj = document.PublisherOrderInq_1;
  if(issue_id!=0) {
    frmObj.issue_id.value = issue_id;
    frmObj.submit();
  } else {
    window.location.href = server_path+"web_versions/index/"+publication;
  }   
}
function selectIssueSue(server_path,issue_id,publication) {
 //alert(server_path);
 //alert("In Sue");
  var frmObj = document.PublisherOrderInq_1;
  if(issue_id!=0) {
    frmObj.issue_id.value = issue_id;
    frmObj.submit();
  } else {
    window.location.href = server_path+"web_versions_sue/index/"+publication;
  }   
}
function selectIssueAbc(server_path,issue_id,publication) {
 //alert(server_path);
  var frmObj = document.PublisherOrderInq_1;
  if(issue_id!=0) {
    frmObj.issue_id.value = issue_id;
    frmObj.submit();
  } else {
    window.location.href = server_path+"web_versions_abc/index/"+publication;
  }   
}
function selectIssueAbcSue(server_path,issue_id,publication) {
 //alert(server_path);
  var frmObj = document.PublisherOrderInq_1;
  if(issue_id!=0) {
    frmObj.issue_id.value = issue_id;
    frmObj.submit();
  } else {
    window.location.href = server_path+"web_versions_abc_sue/index/"+publication;
  }   
}
function subFormChangeOrder(publication) {

  var frmObj = document.PublisherOrderInq_2;
  frmObj.action = "index/"+publication;
  frmObj.submit();
}
function subFormChangeOrderAbc(publication) {
  var frmObj = document.PublisherOrderInq_2;
  frmObj.action = "index/"+publication;
  frmObj.submit();
}
function subFormChangeOrderClient(client_com,keyword) {
  var frmObj = document.PublisherOrderInq_2;
  frmObj.action = "client_index/"+encode64(keyword)+"/"+encode64(client_com);
  frmObj.submit();
}

function checkKeywordExistClient(keyword,server_path,div_id) {
   var objDiv = document.getElementById(div_id);
   if(keyword!= "") { 
      var doc = CreateAjaxObject();
      doc.open("GET",server_path + "web_versions/KeywordExist/"+keyword,false);
      doc.send(null);       
      var Res = doc.responseText
      if(Res == 0) {
            document.getElementById("submit").disabled = "disabled";
            objDiv.style.display ='block';
            objDiv.innerHTML = "<img src='"+server_path+"/img/close.jpeg' width='20' height='20' align='top'></img>&nbsp;<font color='#FF0000' size='1'><strong>This keyword is not available please enter another one</strong></font>";
            
       } else {
            document.getElementById("submit").disabled = "";
            objDiv.innerHTML = "<img src='"+server_path+"/img/checkbox.jpeg' width='20' height='20' align='bottom'></img>&nbsp;<font color='#00CC00' size='1'><strong>This keyword is available</strong></font>";
            objDiv.style.display = 'block';
       }     
   } else {
       if(objDiv.innerHTML!="") {
           objDiv.style.display = 'none';
           objDiv.innerHTML = "";              
       }    
   }   
}
var keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";

function encode64(input) {
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;

   do {
      chr1 = input.charCodeAt(i++);
      chr2 = input.charCodeAt(i++);
      chr3 = input.charCodeAt(i++);

      enc1 = chr1 >> 2;
      enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
      enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
      enc4 = chr3 & 63;

      if (isNaN(chr2)) {
         enc3 = enc4 = 64;
      } else if (isNaN(chr3)) {
         enc4 = 64;
      }

      output = output + keyStr.charAt(enc1) + keyStr.charAt(enc2) + 
         keyStr.charAt(enc3) + keyStr.charAt(enc4);
   } while (i < input.length);
   
   return output;
}

function decode64(input) {
   var output = "";
   var chr1, chr2, chr3;
   var enc1, enc2, enc3, enc4;
   var i = 0;

   // remove all characters that are not A-Z, a-z, 0-9, +, /, or =
   input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");

   do {
      enc1 = keyStr.indexOf(input.charAt(i++));
      enc2 = keyStr.indexOf(input.charAt(i++));
      enc3 = keyStr.indexOf(input.charAt(i++));
      enc4 = keyStr.indexOf(input.charAt(i++));

      chr1 = (enc1 << 2) | (enc2 >> 4);
      chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
      chr3 = ((enc3 & 3) << 6) | enc4;

      output = output + String.fromCharCode(chr1);

      if (enc3 != 64) {
         output = output + String.fromCharCode(chr2);
      }
      if (enc4 != 64) {
         output = output + String.fromCharCode(chr3);
      }
   } while (i < input.length);

   return output;
}

function fn_chkboxvalid(){
//alert("Hi");
}



function fn_newregistration(){
	var frmObj = document.PublisherOrderInq_2;
	frmObj.action = "order_inquiry_registration";
	frmObj.submit();
}
function fn_registereduser(){
	var frmObj = document.PublisherOrderInq_2;
	frmObj.action = "order_inquiry_already_registration";
	frmObj.submit();

}
function selectIssueAbcpsb(server_path,issue_id,publication) {
 //alert(server_path);
  var frmObj = document.PublisherOrderInq_1;
  if(issue_id!=0) {
    frmObj.issue_id.value = issue_id;
    frmObj.submit();
  } else {
    window.location.href = server_path+"web_versions_abc_psb/index/"+publication;
  }   
}
function selectIssueAbcpsbsue(server_path,issue_id,publication) {
 //alert(server_path);
  var frmObj = document.PublisherOrderInq_1;
  if(issue_id!=0) {
    frmObj.issue_id.value = issue_id;
    frmObj.submit();
  } else {
    window.location.href = server_path+"web_versions_abc_psb_sue/index/"+publication;
  }   
}
function selectIssuedf(server_path,issue_id,publication) {

  var frmObj = document.PublisherOrderInq_1;
  if(issue_id!=0) {
    frmObj.issue_id.value = issue_id;
    frmObj.submit();
  } else {
    window.location.href = server_path+"web_versions_df/index/"+publication;
  }   
}

function fn_newregistrationdf(){
	//alert("In New Registration");
	var frmObj = document.PublisherOrderInq_2;
	str=window.location.href
	//alert(str);
	redirect=str.split("?");
	redirect1=redirect[0]
	frmObj.action = "http://www.gotxt.biz/gotxt_betaold/web_versions_df/order_inquiry_registration";
	frmObj.submit();
}
function fn_registereduserdf(){
	//alert("In Registration");
	var frmObj = document.PublisherOrderInq_2;
	str=window.location.href
	//alert(str);
	redirect=str.split("?");
	redirect1=redirect[0]
	frmObj.action = "http://www.gotxt.biz/gotxt_betaold/web_versions_df/order_inquiry_already_registration";
	frmObj.submit();

}

function selectIssueDatateam(server_path,issue_id,publication) {
 //alert(server_path);
  var frmObj = document.PublisherOrderInq_1;
  if(issue_id!=0) {
    frmObj.issue_id.value = issue_id;
    frmObj.submit();
  } else {
    window.location.href = server_path+"web_versions_datateam/index/"+publication;
  }   
}
function selectIssueDatateamSue(server_path,issue_id,publication) { 
  var frmObj = document.PublisherOrderInq_1;
  if(issue_id!=0) {
    frmObj.issue_id.value = issue_id;
    frmObj.submit();
  } else {
    window.location.href = server_path+"web_versions_datateam_sue/index/"+publication;
  }   
}
function selectIssueAlls(server_path,issue_id,publication) { 
  var frmObj = document.PublisherOrderInq_1;
  if(issue_id!=0) {
    frmObj.issue_id.value = issue_id;
    frmObj.submit();
  } else {
    window.location.href =publication;
  }   
}
function fn_newregistrationAdv(){
	//alert("In New Registration");
	var frmObj = document.PublisherOrderInq_2;
	str=window.location.href
	//alert(str);
	redirect=str.split("?");
	redirect1=redirect[0]
	frmObj.action = "http://www.gotxt.biz/gotxt_betaold/advertiser_form/order_inquiry_registration";
	frmObj.submit();
}
function fn_registereduserAdv(){
	//alert("In Registration");
	var frmObj = document.PublisherOrderInq_2;
	str=window.location.href
	//alert(str);
	redirect=str.split("?");
	redirect1=redirect[0]
	frmObj.action = "http://www.gotxt.biz/gotxt_betaold/advertiser_form/order_inquiry_already_registration";
	frmObj.submit();
}