var TYPE="";
var ABEC="";
var LUB="";
var MATE="S";
var DESC = "BALL BEARINGS";
var Mcode;
var popup_window;

function MATE(opt){
	opener.MATE=opt;
}
function ABEC(opt){
	opener.ABEC=opt;
}
function LUB(opt){
	opener.LUB=opt;
}
function TYPE(opt)
{	opener.TYPE = opt	}


// SET ONE
// Example : MoveValue('Option.htm','BB#RIX-2AXXXX','ball bearings with blah');
function MoveValue(url,CODE){
	DESC = document.title
	Mcode=CODE.innerHTML;

	popup_window =window.open(url,'popup1','resizable,height=530,width=500,menubar=no,scrollbars=yes,status=no,toolbar=no,screenX=250%,screenY=70%,');
	popup_window.focus();
}

function CheckPrice(){
	var code=Mcode+TYPE+ABEC+LUB;
	//var shaftLength = prompt('Please specify length in inches','')
	if (MATE=="S") code=code.replace('#','S');
	if (MATE=="X") code=code.replace('#','X');
	if (MATE=="G") code=code.replace('#','G');
	if (MATE=="D") code=code.replace('#','D');
	if (MATE=="H") code=code.replace('#','H');
	if (MATE=="Y") code=code.replace('#','Y');
	var desc=desc; 
	var URL="http://www.qbcbearings.com/eStore/PriceCheck.aspx?code= " + code.replace('–','-') + "&desc=" + DESC;

	popup_window.resizeTo(700,400);
	popup_window.location = URL;

}


// SET TWO
// Ex: MoveValue('BB#RIX-2AXXXX','ball bearings crome finish')
function MoveValue1(CODE){		// <- PASS DESC
	DESC = document.title
	Mcode=CODE.innerHTML;
	var URL="http://www.qbcbearings.com/eStore/PriceCheck.aspx?code= " + Mcode.replace('–','-') + "&desc=" + DESC;        
    window.open(URL,"PriceCheck", 'toolbar=0,width=700,height=450');
}

function GetDetails(length,CODE) {

	if (length == "") return alert("Please select desired length");

	DESC = document.title
	Mcode=CODE.innerHTML + ''+length;

	var URL="http://www.qbcbearings.com/eStore/PriceCheck.aspx?code= " + Mcode.replace('ñ','-') + "&desc=" + DESC;
    	window.open(URL,"PriceCheck", 'toolbar=0,width=700,height=450');
}

