var requiredVersion = 5;			
var maxVersion = 8;

bw=new checkBrowser();

if (bw.ie5&&bw.macOS || bw.ie4&&bw.macOS || bw.ie5&&bw.macOS){
	//document.location.href="http://www.redmonkeydesigns.com/redirect";
	document.location.href="./redirect/index.html";
}


// no touch for you	
var gotFlash2 = false;	
var gotFlash3 = false;
var gotFlash4 = false;
var gotFlash5 = false;
var gotFlash6 = false;
var gotFlash7 = false;
var gotFlash8 = false;
var actualVersion = null;		
var rightVersion = false;	
var ie = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var win = (navigator.appVersion.indexOf("Windows") != -1) ? true : false;
gotFlash();
// ********************************


if (ie && win) { 
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n');
	document.write('on error resume next \n');
	document.write('gotFlash2 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.2"))) \n');
	document.write('gotFlash3 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.3"))) \n');
	document.write('gotFlash4 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.4"))) \n');
	document.write('gotFlash5 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.5"))) \n');
	document.write('gotFlash6 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.6"))) \n');
	document.write('gotFlash7 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.7"))) \n');
	document.write('gotFlash8 = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.8"))) \n');	
	document.write('<\/SCR' + 'IPT\> \n'); 
}

function gotFlash() {	
	if (navigator.plugins) {								
		if ((navigator.plugins["Shockwave Flash 2.0"]) || (navigator.plugins["Shockwave Flash"])) {	
			var ver2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDesc = navigator.plugins["Shockwave Flash" + ver2].description;i
			var curVersion = parseInt(flashDesc.charAt(flashDesc.indexOf(".") - 1));
			gotFlash3 = curVersion == 3;
			gotFlash4 = curVersion == 4;
			gotFlash5 = curVersion == 5;
			gotFlash6 = curVersion == 6;
			gotFlash7 = curVersion == 7;
			gotFlash8 = curVersion == 8;
		}
	}
	for (var i = 2; i <= maxVersion; i++) {	
		if (eval("gotFlash" + i) == true) {
			actualVersion = i;
		}
	}
	if (actualVersion >= requiredVersion) {
		rightVersion = true;
	}	
}


function changeImages() {
    if (document.images) {      
      for (var i=0; i<changeImages.arguments.length; i+=2) {
	  document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
      }
    }
}

function changeClass(id, newClass) {
	alert("changing "+id+" to "+newClass);
	identity=document.getElementById(id);
	alert("retrieved identity "+identity);
	identity.className=newClass;	
}
			
function goToCountryPage(pulldown){
	var country = pulldown.options[pulldown.selectedIndex].value;
	var url = "./store_finder_"+country+".html";
	document.location.href=url;
}

function showCity(country){
	var pulldown = document.forms[0].city_dropdown;
	var city = getName(pulldown.options[pulldown.selectedIndex].text.toLowerCase());
	var url = "./"+country+"_"+city+".html";
	document.location.href=url;
}

function goTo(){
	var pulldown = document.forms[0].places;
	var place = getName(pulldown.options[pulldown.selectedIndex].value);
	var url = "./store_finder_"+place+".html";
	document.location.href=url;
}

function goToArtist(){
	var pulldown = document.forms[0].artists;
	var artist = getName(pulldown.options[pulldown.selectedIndex].text);
	var url = artist+".html";
	document.location.href=url;
}

function getName(name) {
	newName= "";
		
	for (i=0; i<name.length; i++){
		if (name.charAt(i) != ' '){
			newName+=name.charAt(i);	
		}
	}
	newName = newName.toLowerCase();
	return newName;
}


function init(){
	layerWrite('captionText', null, "[01/50] " + cap_1);
	window.status = statusText;
}

function layerWrite(id,nestref,text) {
	if (bw.ns6 || bw.ie5&&bw.macOS){
		document.getElementById(id).innerHTML="<table><tr><td height=50 width=420 align=center valign=top><span class=textStyle>"+text+"</span></td></tr></table>";
	}
	else if (bw.ns4 || bw.ns5){
		var lyr = (nestref)? eval('document.'+nestref+'.document.'+id+'.document') : document.layers[id].document
		lyr.open()
		lyr.write("<table><tr><td height=50 width=408 align=left valign=top><span class=textStyle>"+text+"</span></td></tr></table>");
		lyr.close()
	}
	else if (bw.ie4 || bw.ie5 || bw.ie6){
		document.all[id].innerHTML="<table><tr><td height=50 width=480 align=center valign=top><span class=textStyle>"+text+"</span></td></tr></table>";
	}
}

function checkBrowser(){
  this.os=navigator.OS
  this.ver=navigator.appVersion
  this.dom=document.getElementById?1:0
  this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom)?1:0;
  this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom)?1:0;
  this.ie4=(document.all && !this.dom)?1:0;
  this.ns6=(!document.all && document.getElementById) ? true : false;
  this.ns5=(this.dom && parseInt(this.ver) == 5) ?1:0;
  this.ns4=(document.layers && !this.dom)?1:0;
  this.bw=(this.ie5 || this.ie4 || this.ns4 || this.ns5 || this.ns6)
  this.macOS = navigator.userAgent.indexOf('Mac')!=-1;
  this.winOS = navigator.userAgent.indexOf('Win')!=-1;
  return this;
}

function pressPopup(url, title){
	window.open(url, title, "width=500,height=470,resizable=no,scrollbars=no");
}
