var xmlHttp
var strSpanID
function writeEmailSignupForm(strSpanID1)
{
var qt
qt='"'
document.getElementById(strSpanID1).innerHTML="Email
";
}
function getS7ImageTemplate(s7url,s7form,intSeq,strProductNumber,strSpanID1)
{
strSpanID=strSpanID1;
if (s7url.length==0)
{
document.getElementById(strSpanID).innerHTML="";
return;
}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
document.getElementById(strSpanID).innerHTML="Your browser does not support AJAX!";
return;
}
var s7query = "";
var s7query1 = "";
for (var i in s7form.elements)
{
// &Width=400&StreamerColorLeft=255,220,105&StreamerColorRight=255,220,105
var ss = "attribute_" + strProductNumber + '_' + intSeq + "_";
var n = ss.length;
if (typeof(s7form.elements[i]) == "object" && s7form.elements[i] != null)
{
if (s7form.elements[i].name != null)
{
if (s7form.elements[i].name.length >= n)
{
if (s7form.elements[i].name.substring(0,n) == "attribute_" + strProductNumber + '_' + intSeq + "_")
{
if ("value" in s7form.elements[i])
{
s7query = s7query + "&" + s7form.elements[i].name + "=" + s7form.elements[i].value;
}
else
{
s7query = s7query + "&" + s7form.elements[i].name + "=";
}
}
}
}
}
}
s7query1 = s7query.ReplaceAll(ss,'');
var url="/ajax_submit.asp";
url=url+"?s7url="+urlencode(s7url);
url=url+"&s7query="+urlencode(s7query1);
url=url+"&action=getS7ImageTemplate";
url=url+"&pn="+strProductNumber;
url=url+"&spanid="+strSpanID1;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function ReplaceAll(Source,stringToFind,stringToReplace)
{
var temp = Source;
var index = temp.indexOf(stringToFind);
while(index != -1)
{
temp = temp.replace(stringToFind,stringToReplace);
index = temp.indexOf(stringToFind);
}
return temp;
}
String.prototype.ReplaceAll = function(stringToFind,stringToReplace)
{
var temp = this;
var index = temp.indexOf(stringToFind);
while(index != -1)
{
temp = temp.replace(stringToFind,stringToReplace);
index = temp.indexOf(stringToFind);
}
return temp;
}
function getShippingCharge(id,shell_id,oc,sb,state,zip,country,strSpanID1)
{
strSpanID=strSpanID1;
if (id.length==0)
{
document.getElementById(strSpanID).innerHTML="";
return;
}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="/ajax_submit.asp";
url=url+"?id="+id;
url=url+"&shell_id="+shell_id;
url=url+"&oc="+oc;
url=url+"&sb="+sb;
url=url+"&state="+state;
url=url+"&zip="+zip;
url=url+"&country="+country;
url=url+"&spanid="+strSpanID;
url=url+"&action=getShippingCharge";
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function getProductName(str,strSpanID1)
{
strSpanID=strSpanID1;
if (str.length==0)
{
document.getElementById(strSpanID).innerHTML="";
return;
}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="ajax_submit.asp";
url=url+"?pn="+str;
url=url+"&action=getProductName";
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function addEmail(str,strSpanID1)
{
strSpanID=strSpanID1;
if (str.length==0)
{
document.getElementById(strSpanID).innerHTML="";
return;
}
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Your browser does not support AJAX!");
return;
}
var url="/ajax_submit.asp";
url=url+"?email="+str;
url=url+"&action=addEmail";
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}
function stateChanged()
{
if (xmlHttp.readyState==4)
{
document.getElementById(strSpanID).innerHTML=xmlHttp.responseText;
}
}
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
function urlencode (str) {
// http://kevin.vanzonneveld.net
// + original by: Philip Peterson
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + input by: AJ
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: Brett Zamir (http://brett-zamir.me)
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + input by: travc
// + input by: Brett Zamir (http://brett-zamir.me)
// + bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: Lars Fischer
// + input by: Ratheous
// + reimplemented by: Brett Zamir (http://brett-zamir.me)
// % note 1: This reflects PHP 5.3/6.0+ behavior
// * example 1: urlencode('Kevin van Zonneveld!');
// * returns 1: 'Kevin+van+Zonneveld%21'
// * example 2: urlencode('http://kevin.vanzonneveld.net/');
// * returns 2: 'http%3A%2F%2Fkevin.vanzonneveld.net%2F'
// * example 3: urlencode('http://www.google.nl/search?q=php.js&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a');
// * returns 3: 'http%3A%2F%2Fwww.google.nl%2Fsearch%3Fq%3Dphp.js%26ie%3Dutf-8%26oe%3Dutf-8%26aq%3Dt%26rls%3Dcom.ubuntu%3Aen-US%3Aunofficial%26client%3Dfirefox-a'
var hexStr = function (dec) {
return '%' + dec.toString(16).toUpperCase();
};
var ret = '',
unreserved = /[\w.-]/; // A-Za-z0-9_.- // Tilde is not here for historical reasons; to preserve it, use rawurlencode instead
str = (str+'').toString();
for (var i = 0, dl = str.length; i < dl; i++) {
var ch = str.charAt(i);
if (unreserved.test(ch)) {
ret += ch;
}
else {
var code = str.charCodeAt(i);
// Reserved assumed to be in UTF-8, as in PHP
if (code === 32) {
ret += '+'; // %20 in rawurlencode
}
else if (code < 128) { // 1 byte
ret += hexStr(code);
}
else if (code >= 128 && code < 2048) { // 2 bytes
ret += hexStr((code >> 6) | 0xC0);
ret += hexStr((code & 0x3F) | 0x80);
}
else if (code >= 2048 && code < 65536) { // 3 bytes
ret += hexStr((code >> 12) | 0xE0);
ret += hexStr(((code >> 6) & 0x3F) | 0x80);
ret += hexStr((code & 0x3F) | 0x80);
}
else if (code >= 65536) { // 4 bytes
ret += hexStr((code >> 18) | 0xF0);
ret += hexStr(((code >> 12) & 0x3F) | 0x80);
ret += hexStr(((code >> 6) & 0x3F) | 0x80);
ret += hexStr((code & 0x3F) | 0x80);
}
}
}
return ret;
}