
function popup(target, toolbar, menubar, status, scrollbars, resizable, width, height, top, left)
{
	var options = "";
	
	options += "toolbar=" + toolbar;
	options += ",menubar=" + menubar;
	options += ",status=" + status;
	options += ",scrollbars=" + scrollbars;
	options += ",resizable=" + resizable;
	options += ",width=" + width;
	options += ",height=" + height;
	options += ",top=" + top;
	options += ",left=" + left;

	window.open('',target,options);
}

function sitesearch(lifestyle, query)
{
	if (query != 'Search')
	{
		//var search = "/" + lifestyle + "/search/results.aspx?ls=" + lifestyle + "&q=" + query;
		
		var search = 'http://find.yamaha-motor.com/?q=' + query + '&pa=' + lifestyle;
		if (lifestyle == 'star')
			search = 'http://search.starmotorcycles.com/?q=' + query + '&pa=' + lifestyle;
		
		document.location = search;
	}
}

function addOnLoadEvent(func, param) {
	var oldonload = window.onload;
	if (window != null && window.onload == null) {
		if (param.length > 0) {
			window.onload = func(param);
		} else {
			window.onload = func;
		}
	} else {
		if (param.length > 0) { 
			window.onload = function() { oldonload(); func(param);}
		} else { 
			window.onload = function() { oldonload(); func();}
		}
	}
}

function pageLoaded() {
	if ( document.getElementById("menuObj") ) {
		if (browsername.indexOf("Microsoft")!=-1) {
			nmovie = document.getElementById("menuObj");
			nmovie.SetVariable("isLoaded","1");
			nmovie.GotoFrame(1);
			nmovie.Play();
			}	
	}
}

function positionLayer2 (obj, img) {
	getObjMetricsDOM(img);
	obj.style.left = (img.flyX + 160) + "px";
	obj.style.top = (img.flyY - 0) + "px";
}

function sendToFlash(item) {
	var browsername=navigator.appName;
	var myText = item;
	
	if (document.getElementById) { var style2 = document.getElementById("Layer1").style; }
	else if (document.all)	     { var style2 = document.all["Layer1"].style; } 
	else if (document.layers)    { var style2 = document.layers["Layer1"].style; }
	
	positionLayer2(document.getElementById("Layer1"),document.getElementById("LeftNavPosImg"));
	style2.visibility = "visible";
	
	if (browsername.indexOf("Microsoft")!=-1) {
		movie = document.getElementById("popObj");
		movie.SetVariable("myFrame",myText)
		movie.GotoFrame(1);
		movie.Play();
	} else { 
		flashProxy.call("nonIE", myText);}

}
function test() {
	alert('test');
} 
function movieOff() {
	if (document.getElementById) { var style2 = document.getElementById("Layer1").style; }
	else if (document.all)	     { var style2 = document.all["Layer1"].style; }
	else if (document.layers)    { var style2 = document.layers["Layer1"].style; }
	style2.visibility = "hidden";
}

// Dynamically load navigation elements
jQuery(window).load(function ($) {
    // This variable is set by the navigation file, as such, if it is defined
    //      then we do not need to load the navigation
    if (typeof _navigationLoaded != "undefined") { return; }

    // Load the navigation file
    var navigationScript = '/assets/common/js/navigation.ashx';
    if (typeof _navigationSettings != "undefined") {
        navigationScript += '?version=' + _navigationSettings.Version + '&id=' + _navigationSettings.Id;
    }

    (function () {
        var nav = document.createElement('script');
        nav.type = 'text/javascript';
        nav.async = true;
        nav.src = navigationScript;
        var tags = document.getElementsByTagName('script');
        var s = tags[tags.length - 1];
        s.parentNode.insertBefore(nav, s);
    })();
});
