function LinkFromFlash(href, redirect) {
    var confirm_redirect = true;
    if (document.URL.indexOf("dbcmlv=1") != -1) {
        if (redirect) {
            confirm_redirect = confirm("LinkFromFlash, OK to redirect:\nHref: " + href + "\nName: " + name);
        } else {
            alert("LinkFromFlash:\nHref: " + href + "\nName: " + name);
        }
    }
    if (redirect && confirm_redirect) {
        document.location = href;
    }
}

function driveParent (destination) {
                if (window.opener) {
                                window.opener.location.href = destination;
                                window.opener.focus ();
                } else {
                                // If the user closed the parent window, create a new one
                                var newWin = window.open (destination, '', '');
                                newWin.focus ();
                }
}

function createPopUp(url, name, optionString) {
	if (!name){
   name = "newwnd";
	}
	if (!optionString){
   optionString = "toolbar=no,location=no,directories=no,scrollbars=yes,resizable=yes,height=500,width=730,screenX=4,screenY=4,top=4,left=4";
	}   
	win = window.open(url, name, optionString);
	win.focus();
}

//  Gear Page functions
function changeHero(gear,color) {
   	dojo.query("#hero_0 div[id], #colors_0 div[id]").forEach("item.style.visibility='hidden';")
   	dojo.query("#hero_" + gear + '_' + color).forEach("item.style.visibility='visible';");
	dojo.query("#colors_" + gear).forEach("item.style.visibility='visible';");
}

function changeName(name) {
   	dojo.query("#colorname_0 div[id]").forEach("item.style.visibility='hidden';")
   	dojo.query("#colorname_" + name).forEach("item.style.visibility='visible';");
}

function changeBarbie(doll,flash) {
   	dojo.query("#flash_0 div[id], #doll_0 div[id]").forEach("item.style.visibility='hidden';")
   	dojo.query("#flash_" + doll + '_' + flash).forEach("item.style.visibility='visible';");
   	dojo.query("#showFlashPathDiv" + flash).forEach("item.style.visibility='visible';");
	dojo.query("#doll_" + doll).forEach("item.style.visibility='visible';");
}
   
dojo.query(".gearNext").forEach(function(item){
	dojo.connect(item, "click", null, function(evt){
		evt.preventDefault();
		dojo.query("#staticScroller_1").forEach("style.visibility='hidden';");
		dojo.query("#staticScroller_2").forEach("style.visibility='visible';");
	});
});
dojo.query(".gearNext").forEach(function(item){
	dojo.connect(item, "click", null, function(evt){
		evt.preventDefault();
		dojo.query("#staticScroller_1").forEach("style.visibility='visible';");
		dojo.query("#staticScroller_2").forEach("style.visibility='hidden';");
	});
});

