
$(document).ready(function() {
	$("#home-banner").cycle();
});

$(document).ready(function() {
	$(".slide").cycle();
});

$(document).ready(function(){
	$(".thickbox").fancybox();
});

/* POPUP WINDOWS */

var newWindow = null;
function closeWin(){
	if (newWindow != null){
		if(!newWindow.closed)
			newWindow.close();
	}
}

function popUpWin(url, type, strWidth, strHeight){
	closeWin();
	if (type == "fullScreen"){
		strWidth = screen.availWidth - 10;
		strHeight = screen.availHeight - 160;
	}
	var tools="";
	if (type == "standard" || type == "fullScreen") tools = "resizable,toolbar=yes,location=yes,scrollbars=yes,menubar=yes,width="+strWidth+",height="+strHeight+",top=0,left=0";
	if (type == "console") tools = "resizable,toolbar=no,location=no,scrollbars=yes,width="+strWidth+",height="+strHeight+",left=0,top=0";
	newWindow = window.open(url, 'newWin', tools);
	newWindow.focus();
}



/* ENEWSLETTER WATERMARK */

$(document).ready(function() {
	$("#enews_email").blur(function() {
		if((this).value=="") {
			$(this).attr("value","email address");
			return false;
		}
	});

	$("#enews_email").focus(function() {
		$(this).attr("value","");
		return false;
	});	
});




/* DROPDOWNS */


var mrMac = (navigator.userAgent.indexOf('Mac') != -1);
	if (!mrMac) {
		sfHover = function() {
			var sfEls = document.getElementById("primary-nav").getElementsByTagName("LI");
			for (var i=0; i<sfEls.length; i++) {
				sfEls[i].onmouseover=function() {
					this.className+=" over";
				}
				
				sfEls[i].onmouseout=function() {
					this.className=this.className.replace(new RegExp(" over\\b"), "");
				}
			}
		}
		if (window.attachEvent) window.attachEvent("onload", sfHover);
	}	

var mrMac = (navigator.userAgent.indexOf('Mac') != -1);
	if (!mrMac) {
		sfHover = function() {
			var sfEls = document.getElementById("utility-nav").getElementsByTagName("LI");
			for (var i=0; i<sfEls.length; i++) {
				sfEls[i].onmouseover=function() {
					this.className+=" over";
				}
				
				sfEls[i].onmouseout=function() {
					this.className=this.className.replace(new RegExp(" over\\b"), "");
				}
			}
		}
		if (window.attachEvent) window.attachEvent("onload", sfHover);
	}	



/* RANDOM STRIP BANNER */



$(document).ready(function() {
	var randy=Math.floor(Math.random()*4);

	if (randy == 1){
		$("#strip").removeClass();
		$("#strip").addClass("strip-toyota");
	}	
	else if (randy == 2){
		$("#strip").removeClass();
		$("#strip").addClass("strip-raymond");
	}
	else if (randy == 3){
		$("#strip").removeClass();
		$("#strip").addClass("strip-bt");
	}
	else if (randy == 4){
		$("#strip").removeClass();
		$("#strip").addClass("strip-range");
	}
	else{
		$("#strip").removeClass();
		$("#strip").addClass("strip-enviro");
	}		
	
});


