// JavaScript Document


/* Modified to support Opera */
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}



function popup(src) {
  win = window.open(src,"","top=20,left=20,height=300,width=450,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes")
}


function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}


//<![CDATA[
	function ShowMyDialog(button, url)
	{
		//use CuteEditor_GetEditor(elementinsidetheEditor) to get the cute editor instance
		var editor=CuteEditor_GetEditor(button);
		//alert( url );
		//show the dialog page , and pass the editor as newwin.dialogArguments
		var newwin=showModelessDialog( url ,editor,"dialogWidth:320px;dialogHeight:220px");
		
	}
    function AddToCart(item_name, item_number, price )
    {
        var make = document.getElementById('make');
        var factory = document.getElementById('factory');
        var url = "";
        var business = 'cs@backcountryracks.com';
        if( make == null )
        {
            url = "https://www.paypal.com/cart/add=1&cmd=_cart&business=" + business + "&item_name=" + item_name + "&item_number=" + item_number + "&amount=" + price + "&return=http://www.backcountryracks.com/";        
        }
        else if( make.value.length == 0 )
        {
            alert("You must enter the make and model of your car.");
            document.getElementById('make').focus();
            return;
        }
        else
            url = "https://www.paypal.com/cart/add=1&cmd=_cart&business=" + business + "&item_name=" + item_name + "&item_number=" + item_number + "&amount=" + price + "&on0=Vehicle&os0=" + make.value + "&on1=Factory Rack&os1=" + factory.checked + "&return=http://www.backcountryracks.com/";

        //alert( url );
        
        //window.location.href = url;
        popUp(url);
    }
    function popUp(URL) {
        eval("paypal = window.open(URL, 'paypal', 'toolbar=1,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=700,height=450');");
    }
    function myPopUp(URL,Width,Height)
    {
        day = new Date();
        id = day.getTime();
        eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=0,width=" + Width + ",height=" + Height + "');");
    }
    //]]>