function getcode(code,bannerID,productID) {
changeID(code);
setCookie(code);
var pagestring="../../get-code.html?partnerID="+code+"&amp;bannerID="+bannerID+"&amp;productID="+productID;
var options="toolbar=0, status=0, menubar=0, scrollbars=1, resizable=1, width=600, height=450";
var win=window.open(pagestring, 'codewindow',options);
win.focus();
}
function getcode_ex(productID, unic_number) {
var id_code_name = 'affiliate_id_'+unic_number;
var get_lp_name = 'get_lp_'+unic_number;
var get_buynow_name = 'get_buynow_'+unic_number;
var code = getElem(id_code_name).value;
if (!code)
{
alert('Please, type in your Affiliate ID');
return false;
}
changeID(code);
setCookie(code);
var pagestring="../../get-code.html?partnerID="+code+"&amp;productID="+productID;
var get_lp = getElem(get_lp_name);
var get_buynow = getElem(get_buynow_name);
if ( (get_lp && get_lp.value && !get_buynow) || (get_lp && get_lp.value && get_lp.checked) )
{
pagestring += "&amp;get_lp=1&amp;bannerID="+get_lp.value;
}
if ( (get_buynow && get_buynow.value && !get_lp) || (get_buynow && get_buynow.value && get_buynow.checked) )
{
pagestring += "&amp;get_buynow=1&amp;bannerID="+get_buynow.value;
}
var options="toolbar=0, status=0, menubar=0, scrollbars=1, resizable=1, width=600, height=450";
var win=window.open(pagestring, 'codewindow',options);
win.focus();
}
function getElem(id) {
if (document.getElementById)
return document.getElementById(id);
else
return document.all(id);
}
function hide(id) {
for (var i = 0; i != blocks.length; i++) {
if (blocks[i].className != id ) blocks[i].parentNode.style.display='none';
if (blocks[i].className == id ) blocks[i].parentNode.style.display='block';
if (id==0) blocks[i].parentNode.style.display='block';
}
}
function onw(sr,alt, w, h) {
options="toolbar=0, status=0, menubar=0, scrollbars=1, resizable=0, width="+w+", height="+h+"";
OpenWindow=window.open("", "imgn", options);
OpenWindow.document.write("<html><body style='margin:0;padding:0;'>");
OpenWindow.document.write("<img src="+sr+" alt="+alt+" width="+w+" height="+h+" />");
OpenWindow.document.write("</body></html>");
OpenWindow.focus();
OpenWindow.document.close();
self.name="main";
}
function changeID(a) {
var i=0;
while (o=document.getElementsByTagName('INPUT')[i]) {
if (o.id.match(/id/)) {
o.value=a;
}
i++;
}
}
function setCookie(a) {
var today = new Date(), expires = new Date(today.getTime()+365*24*3600);
document.cookie = "affiliate_id="+escape(a)+";expires="+expires.toGMTString()+";path=/";
}
function getCookie() {
var i=0;
while(c=document.cookie.split(';')[i]) {
if (c.match(/affiliate_id/)) {
return c.replace(/[^=]*=/,'');
}
i++;
}
return '';
}