var active="RC4";
var activePrice=0;

var priceRC1=59; //lite
var priceRC2=79; //plus
var priceRC3=89; //pro
var priceRC4=89; //duo
var priceRC5=69; //multi
var priceRC6=39; //nano
var priceRC7=79; //4her
var priceRC8=119; //universal
var priceBPP=179; //Power Pack

var altActive=0;


function goBuy() {
if (active == "RC1" || active == "RC2" || active == "RC4") {document.PAYPAL.submit();}
else {alert("This model is not available. Please choose available model.");} 
}


function init() {
//LITE
document.getElementById("RC1").style.left = "29px";
document.getElementById("RC1").style.top = "80px";
document.getElementById("RC1").style.zIndex = "2"; //document.getElementById("RC1").style.backgroundImage = "url(http://www.pokerremotecontrol.com/images/RC1.jpg)";
//PLUS
document.getElementById("RC2").style.left = "71px";
document.getElementById("RC2").style.top = "110px";
document.getElementById("RC2").style.zIndex = "3"; //document.getElementById("RC2").style.backgroundImage = "url(http://www.pokerremotecontrol.com/images/RC2.jpg)";
//PROFESSIONAL
document.getElementById("RC3").style.left = "231px";
document.getElementById("RC3").style.top = "110px";
document.getElementById("RC3").style.zIndex = "3"; //document.getElementById("RC3").style.backgroundImage = "url(http://www.pokerremotecontrol.com/images/RC3.jpg)";
//DUO
document.getElementById("RC4").style.left = "147px";
document.getElementById("RC4").style.top = "140px";
document.getElementById("RC4").style.zIndex = "5"; //document.getElementById("RC4").style.backgroundImage = "url(http://www.pokerremotecontrol.com/images/RC4.jpg)";
//MULTI-TABLER
document.getElementById("RC5").style.left = "-999292px";
document.getElementById("RC5").style.top = "100px";
document.getElementById("RC5").style.zIndex = "2";

//NANO
document.getElementById("RC6").style.left = "274px";
document.getElementById("RC6").style.top = "80px";
document.getElementById("RC6").style.zIndex = "1";
//4HeR
document.getElementById("RC7").style.left = "-99952px";
document.getElementById("RC7").style.top = "75px";
document.getElementById("RC7").style.zIndex = "1";
//UNIVERSAL
document.getElementById("RC8").style.left = "151px";
document.getElementById("RC8").style.top = "53px";
document.getElementById("RC8").style.zIndex = "0";


//sp ("RC4"); INIT////
activePrice=priceRC4; 
document.BUY.total.value="$"+priceRC4; 
document.PAYPAL.item_name.value = "1 Poker Remote Control Duo"; 
document.PAYPAL.amount.value = priceRC4; 
////////////////////////

if (document.cookie.length>0)
  {
  document.CP.coupon.value=document.cookie.substring(document.cookie.indexOf('AFFI=')+5) 
  }

}







function altPrice (n) {
if (n == "BPP") {activePrice=priceBPP; altActive=1; document.BUY.total.value="$"+priceBPP; document.PAYPAL.item_name.value = "1 Poker Remote Control Power-Pack"; document.PAYPAL.amount.value = priceBPP; }
}







function sp(x) {

if (active != x) {

ot(x);

var templ=document.getElementById(x).style.left;
var tempt=document.getElementById(x).style.top;
var tempz=document.getElementById(x).style.zIndex;

document.getElementById(x).style.top = document.getElementById(active).style.top;
document.getElementById(x).style.left = document.getElementById(active).style.left;
document.getElementById(x).style.zIndex = document.getElementById(active).style.zIndex;

document.getElementById(active).style.top = tempt;
document.getElementById(active).style.left = templ;
document.getElementById(active).style.zIndex = tempz;

if (x == "RC1") {document.getElementById("buynow").style.color = "#fff"; showBN(); activePrice=priceRC1; document.BUY.total.value="$"+priceRC1; document.PAYPAL.item_name.value = "1 Poker Remote Control Lite"; document.PAYPAL.amount.value = priceRC1; }
if (x == "RC2") {document.getElementById("buynow").style.color = "#fff"; showBN(); activePrice=priceRC2; document.BUY.total.value="$"+priceRC2; document.PAYPAL.item_name.value = "1 Poker Remote Control Plus"; document.PAYPAL.amount.value = priceRC2; }
if (x == "RC3") {document.getElementById("buynow").style.color = "#333"; hideBN("RC3"); activePrice=priceRC3; document.BUY.total.value="$"+priceRC3; document.PAYPAL.item_name.value = "1 Poker Remote Control Professional"; document.PAYPAL.amount.value = priceRC3; }
if (x == "RC4") {document.getElementById("buynow").style.color = "#fff"; showBN(); activePrice=priceRC4; document.BUY.total.value="$"+priceRC4; document.PAYPAL.item_name.value = "1 Poker Remote Control Duo"; document.PAYPAL.amount.value = priceRC4; }
if (x == "RC5") {document.getElementById("buynow").style.color = "#333"; hideBN("RC5"); activePrice=priceRC5; document.BUY.total.value="$"+priceRC5; document.PAYPAL.item_name.value = "1 Poker Remote Control Multi-Tabler"; document.PAYPAL.amount.value = priceRC5; }
if (x == "RC6") {document.getElementById("buynow").style.color = "#333"; hideBN("RC6"); activePrice=priceRC6; document.BUY.total.value="$"+priceRC6; document.PAYPAL.item_name.value = "1 Poker Remote Control Nanno";document.PAYPAL.amount.value = priceRC6; }
if (x == "RC7") {document.getElementById("buynow").style.color = "#333"; hideBN("RC7"); activePrice=priceRC7; document.BUY.total.value="$"+priceRC7; document.PAYPAL.item_name.value = "1 Poker Remote Control 4Her"; document.PAYPAL.amount.value = priceRC7; }
if (x == "RC8") {document.getElementById("buynow").style.color = "#333"; hideBN("RC8"); activePrice=priceRC8; document.BUY.total.value="$"+priceRC8; document.PAYPAL.item_name.value = "1 Poker Remote Control Universal"; document.PAYPAL.amount.value = priceRC8; }
////////////////*****IF EDITING ABOVE CODE, DON'T FORGET TO EDIT resetActive()*******//////////////////////

active=x;

} else {

if (x == "RC1") {showImage('LITE');}
else if (x == "RC2") {showImage('PLUS');} 
else if (x == "RC4") {showImage('DUO');}

//var new_win="images/" + y + ".jpg";
// {window.open(new_win,x,'toolbar=no,location=no,directories=no,status=yes,menubar=no,resizable=yes,scrollbars=yes,width=720,height=920,left=20,top=10'); }

}

} 



function checkCP()
{ 
if (document.cookie.length>0)
  {
  document.PAYPAL.custom.value=document.cookie.substring(document.cookie.indexOf('AFFI=')+5) 
  document.PAYPAL.amount.value = document.PAYPAL.amount.value - 4;

if (document.PAYPAL.custom.value == "blook") { document.PAYPAL.amount.value-=6; }

  }
//if (active == "RC1" || active == "RC2" || active == "RC4" || altActive == 1) {
//  document.PAYPAL.amount.value = document.PAYPAL.amount.value *0.51;	
//  document.PAYPAL.amount.value = document.PAYPAL.amount.value.substring(0,5);
//}

}





function resetPrice()
{
  document.PAYPAL.amount.value = activePrice;
}




function ov(x) {
if (active != x) {
var y=parseInt(document.getElementById(x).style.top) - 10;
document.getElementById(x).style.top = y + "px";
}} 

function ovs(x) {
if (active != x) {
var y=parseInt(document.getElementById(x).style.top) - 5;
document.getElementById(x).style.top = y + "px";
}} 

function ot(x) {
if (active != x) {
var y=parseInt(document.getElementById(x).style.top) + 10;
document.getElementById(x).style.top = y + "px";
}} 

function ots(x) {
if (active != x) {
var y=parseInt(document.getElementById(x).style.top) + 5;
document.getElementById(x).style.top = y + "px";
}} 










function hideImage (name) {
  var c = document.getElementById(name);
  c.style.left        = -5000+"px";
}



function hideAll () {
hideImage('INTRO');
hideImage('INFO');
hideImage('MTT');
hideImage('EXR');
hideImage('CMP');
hideImage('DEMO');
hideImage('LITE');
hideImage('PLUS');
hideImage('DUO');
}



function resetActive() {
altActive=0;

if (x == "RC1") {showBN(); activePrice=priceRC1; document.BUY.total.value="$"+priceRC1; document.PAYPAL.item_name.value = "1 Poker Remote Control Lite"; document.PAYPAL.amount.value = priceRC1; }
if (x == "RC2") {showBN(); activePrice=priceRC2; document.BUY.total.value="$"+priceRC2; document.PAYPAL.item_name.value = "1 Poker Remote Control Plus"; document.PAYPAL.amount.value = priceRC2; }
if (x == "RC3") {hideBN("RC3"); activePrice=priceRC3; document.BUY.total.value="$"+priceRC3; document.PAYPAL.item_name.value = "1 Poker Remote Control Professional"; document.PAYPAL.amount.value = priceRC3; }
if (x == "RC4") {showBN(); activePrice=priceRC4; document.BUY.total.value="$"+priceRC4; document.PAYPAL.item_name.value = "1 Poker Remote Control Duo"; document.PAYPAL.amount.value = priceRC4; }
if (x == "RC5") {hideBN("RC5"); activePrice=priceRC5; document.BUY.total.value="$"+priceRC5; document.PAYPAL.item_name.value = "1 Poker Remote Control Multi-Tabler"; document.PAYPAL.amount.value = priceRC5; }
if (x == "RC6") {hideBN("RC6"); activePrice=priceRC6; document.BUY.total.value="$"+priceRC6; document.PAYPAL.item_name.value = "1 Poker Remote Control Nanno";document.PAYPAL.amount.value = priceRC6; }
if (x == "RC7") {hideBN("RC7"); activePrice=priceRC7; document.BUY.total.value="$"+priceRC7; document.PAYPAL.item_name.value = "1 Poker Remote Control 4Her"; document.PAYPAL.amount.value = priceRC7; }
if (x == "RC8") {hideBN("RC8"); activePrice=priceRC8; document.BUY.total.value="$"+priceRC8; document.PAYPAL.item_name.value = "1 Poker Remote Control Universal"; document.PAYPAL.amount.value = priceRC8; }
}



function showBN () {
document.getElementById("BN0").style.left = "-5000px";
document.getElementById("BN").style.left = "300px";
}

function hideBN (xy) {
document.getElementById("BN").style.left = "-5000px";
//if ( xy == "RC3") {document.getElementById("BN0val").firstChild.nodeValue = "$"+priceRC3+" (2012)";}
//else if ( xy == "RC5") {document.getElementById("BN0val").firstChild.nodeValue = "$"+priceRC5+" (2010)";}
//else if ( xy == "RC6") {document.getElementById("BN0val").firstChild.nodeValue = "$"+priceRC6+" (2011)";}
//else if ( xy == "RC7") {document.getElementById("BN0val").firstChild.nodeValue = "$"+priceRC7+" (2014)";}
//else if ( xy == "RC8") {document.getElementById("BN0val").firstChild.nodeValue = "$"+priceRC8+" (2015)";}
document.getElementById("BN0").style.left = "323px";
}



function showImage (name) {
  var c = document.getElementById(name);
  c.style.left        = "0px";
}


function switchFnc (name) {
  var c = document.getElementById(name);
  var val = document.getElementById(name).style.backgroundImage;
if ( (val.indexOf('-b')) < 0) {
  c.style.backgroundImage = "url(http://www.pokerremotecontrol.com/images/"+name+"-b.jpg)";
}
else {
	c.style.backgroundImage = "url(http://www.pokerremotecontrol.com/images/"+name+".jpg)";
}
}
