/*******************************
* This file needs to be cleaned up at some point!
*******************************/

// Utill Functions

function $(id) {
  return document.getElementById(id);
}

// Pop-ups

var win= null;

function NewWindow(mypage,myname,w,h){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars='+scroll+',';
      settings +='resizable=yes';
  win=window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

function NewWindow2(mypage,myname,w,h){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars=yes,';
      settings +='resizable=no';
  win=window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

function popup(page) {
		var w = window.open(null, '', "width=400,height=300,scrollbars=yes,resizable=yes,status=no,statusbar=no,locationbar=no,menubar=no,toolbar=no");
		w.location.href = page;
		return false;
}

function popup2(page, w, h) {
		var w = window.open(null, '', "width=" + w + ",height=" + h + ",scrollbars=yes,resizable=yes,status=no,statusbar=no,locationbar=no,menubar=no,toolbar=no");
		w.location.href = page;
		return false;
}

// MODLER
   function PopUp(){
    var ScreenWidth=window.screen.width;
    var ScreenHeight=window.screen.height;
    var movefromedge=0;
    placementx=(ScreenWidth/2)-((420)/2);
    placementy=(ScreenHeight/2)-((200+50)/2);
    var PopUpUrl="/shots_modeler.php"
    WinPop=window.open(PopUpUrl,"","width=656,height=600,toolbar=0,location=0,directories=0,status=0,scrollbars=1,menubar=0,resizable=0,left="+placementx+",top="+placementy+",screenX="+placementx+",screenY="+placementy+",");
   }
   
   
// FLOOR PRO
   function PopUp2(){
    var ScreenWidth=window.screen.width;
    var ScreenHeight=window.screen.height;
    var movefromedge=0;
    placementx=(ScreenWidth/2)-((420)/2);
    placementy=(ScreenHeight/2)-((200+50)/2);
    var PopUpUrl="/shots_fp.php"
    WinPop=window.open(PopUpUrl,"","width=656,height=600,toolbar=0,location=0,directories=0,status=0,scrollbars=1,menubar=0,resizable=0,left="+placementx+",top="+placementy+",screenX="+placementx+",screenY="+placementy+",");
   }  
   
   
// PT
   function PopUp3(){
    var ScreenWidth=window.screen.width;
    var ScreenHeight=window.screen.height;
    var movefromedge=0;
    placementx=(ScreenWidth/2)-((420)/2);
    placementy=(ScreenHeight/2)-((200+50)/2);
    var PopUpUrl="/shots_pt.php"
    WinPop=window.open(PopUpUrl,"","width=656,height=600,toolbar=0,location=0,directories=0,status=0,scrollbars=1,menubar=0,resizable=0,left="+placementx+",top="+placementy+",screenX="+placementx+",screenY="+placementy+",");
   }  

  
// MAT
   function PopUp5(){
    var ScreenWidth=window.screen.width;
    var ScreenHeight=window.screen.height;
    var movefromedge=0;
    placementx=(ScreenWidth/2)-((420)/2);
    placementy=(ScreenHeight/2)-((200+50)/2);
    var PopUpUrl="/shots_mat.php"
    WinPop=window.open(PopUpUrl,"","width=656,height=600,toolbar=0,location=0,directories=0,status=0,scrollbars=1,menubar=0,resizable=0,left="+placementx+",top="+placementy+",screenX="+placementx+",screenY="+placementy+",");
   } 
   
   
// SOG
   function PopUp6(){
    var ScreenWidth=window.screen.width;
    var ScreenHeight=window.screen.height;
    var movefromedge=0;
    placementx=(ScreenWidth/2)-((420)/2);
    placementy=(ScreenHeight/2)-((200+50)/2);
    var PopUpUrl="/shots_sog.php"
    WinPop=window.open(PopUpUrl,"","width=656,height=600,toolbar=0,location=0,directories=0,status=0,scrollbars=1,menubar=0,resizable=0,left="+placementx+",top="+placementy+",screenX="+placementx+",screenY="+placementy+",");
   }                  
   
   
// RC
   function PopUp7(){
    var ScreenWidth=window.screen.width;
    var ScreenHeight=window.screen.height;
    var movefromedge=0;
    placementx=(ScreenWidth/2)-((420)/2);
    placementy=(ScreenHeight/2)-((200+50)/2);
    var PopUpUrl="/shots_rc.php"
    WinPop=window.open(PopUpUrl,"","width=656,height=600,toolbar=0,location=0,directories=0,status=0,scrollbars=1,menubar=0,resizable=0,left="+placementx+",top="+placementy+",screenX="+placementx+",screenY="+placementy+",");
   }  
   
   
// PULT
   function PopUp8(){
    var ScreenWidth=window.screen.width;
    var ScreenHeight=window.screen.height;
    var movefromedge=0;
    placementx=(ScreenWidth/2)-((420)/2);
    placementy=(ScreenHeight/2)-((200+50)/2);
    var PopUpUrl="/shots_pult.php"
    WinPop=window.open(PopUpUrl,"","width=656,height=600,toolbar=0,location=0,directories=0,status=0,scrollbars=1,menubar=0,resizable=0,left="+placementx+",top="+placementy+",screenX="+placementx+",screenY="+placementy+",");
   }  
   
   
// FELT
   function PopUp9(){
    var ScreenWidth=window.screen.width;
    var ScreenHeight=window.screen.height;
    var movefromedge=0;
    placementx=(ScreenWidth/2)-((420)/2);
    placementy=(ScreenHeight/2)-((200+50)/2);
    var PopUpUrl="/shots_felt.php"
    WinPop=window.open(PopUpUrl,"","width=656,height=600,toolbar=0,location=0,directories=0,status=0,scrollbars=1,menubar=0,resizable=0,left="+placementx+",top="+placementy+",screenX="+placementx+",screenY="+placementy+",");
   }
   
// Cart Functions
function doAction(form, action) {
	form.elements["action"].value = action;
	form.submit();
	return false;
}

function setValue(el1, el2) {
	el2.value = el1.value;
}

function addToCart(key) {
 $('cart'+key).submit();
}