// ecatalogue.js

var eCatNeedVersion = 6; // todo: verify minimum flash version compatible
var eCatPlugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
var eCatDhtmlUrl = "http://s7ondemand4.scene7.com/s7ondemand/brochure/dhtml_brochure.jsp?company=Signet&sku=";
var eCatFlashUrl = "http://s7ondemand4.scene7.com/s7ondemand/brochure/flash_brochure.jsp?company=Signet&sku=";

if (eCatPlugin) {
	var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	for (var i = 0; i < words.length; ++i) {
		if (isNaN(parseInt(words[i])))
		continue;
		var pluginVersion = words[i]; 
	}
	var flashCanPlay = pluginVersion >= eCatNeedVersion;
} else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 
   && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\>\n'); //PJD: Stop IE4.5 Mac thinking we're starting a new scriptblock by splitting the tag
	document.write('on error resume next \n');
	document.write('flashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & eCatNeedVersion)))\n');
	document.write('</SCR' + 'IPT\>\n');
}

function showCatalogue(ecat) {
	if (flashCanPlay) {
		openFlashVersion(ecat);
	} else {
		openDhtmlVersion(ecat);
	}
	return false;
}

function openFlashVersion(ecat) {
	var url = eCatFlashUrl + ecat;
	var properties = 'left=10,top=10,width=600,height=430,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes';
	window.open(url, "", properties);
}

function openDhtmlVersion(ecat) {
	var url = eCatDhtmlUrl + ecat;
	var properties = 'left=10,top=10,width=600,height=430,toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes';
	window.open(url, "", properties);
}

