// Login
function login(S,PB) {
 window.name = 'main';
 window.open('http://www.showdowncards.com/login.php?s=' + S + '&pb=' + PB,'_new','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=230,height=150,left=150,top=20');
}

// Buypage Image Popup
function popuppic(IMG) {

 window.open('/image.php?src='+IMG,'image','toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=253,height=355,left=150,top=20');

}

// Popup Store
function store_link(SKU) {

 window.open('/store.php?sku='+SKU,'store','toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=1,width=800,height=640,left=150,top=20');

}

function open_store(CC) {

 window.open('/openstore.php?CC='+CC,'store','toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=1,resizable=1,width=800,height=640,left=150,top=20');

}

// Popup Key Table
function search_key(GAME,PART) {
 if(GAME==0) { GAME = 'mlb'; }
 if(GAME==1) { GAME = 'nfl'; }
 if(GAME==2) { GAME = 'nba'; }

 var URL = "/" + GAME + "/searchkey.html#" + PART + "";

 window.open(URL, 'sk', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=270,height=400,left=510,top=312');

}

// Team Builder Help Pop-up
function teambuilder_help(GAME) {
 if(GAME==0) { GAME = 'mlb'; }
 if(GAME==1) { GAME = 'nfl'; }
 if(GAME==2) { GAME = 'nba'; }

 var URL = "/" + GAME + "/teambuilder_help.html";

 window.open(URL, 'tb_help', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=315,left=510,top=312');

}

// Mycollection Help Pop-up
function mycollection_help(GAME) {
 if(GAME==0) { GAME = 'mlb'; }
 if(GAME==1) { GAME = 'nfl'; }
 if(GAME==2) { GAME = 'nba'; }

 var URL = "/" + GAME + "/mycollection_help.html";

 window.open(URL, 'mc_help', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=400,height=480,left=510,top=312');

}

// Swap Plus/Check images for collection
function imgswap(name, type)
{
 eval("document." + name + ".src = '../images/" + type + ".gif'");
}

function confirm_addition()
{
 var conf = confirm('In order to use this feature you must be a registered member. \nIf you are already a registered member, you must be logged in. \n\nTo register click OK.');
 return conf;
}

function calc(form)  // calculate all cost fields
  {
  var rules, bullpen, bench;

  // 12 Required Players
  var Players =
    13 +
    parseInt(form.bullpen.options[form.bullpen.options.selectedIndex].value) +
    parseInt(form.bench.options[form.bench.selectedIndex].value);

    form.moreplayers.value=Players;
    form.totalplayers.value=Players;
}

function checkTeam(form) {
 if(form.teamname.value == "") {
  alert('Your team must have a name.');
  return false;
 }
 if(form.totalplayers.value > 20) {
  alert('You have exceeded 20 players.\nPlease revise your selections.');
  return false;
 }
 if(form.totalplayers.value < 20) {
  alert('You must have at least 20 players.\nPlease revise your selections.');
  return false;
 }
 if(form.rules.options[form.rules.options.selectedIndex].value == "") {
  alert('You must select the rules you wish to play by.\nAmerican or National');
  return false;
 }

 return true;

}

function confirmDelete(ITEM) {
  var conf = confirm("Clicking OK will delete all players currently in " + ITEM + ".\nAre you sure you want to delete " + ITEM + " .");
  return conf;
}
