<!--
// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 7;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Revision of Flash required
var requiredRevision = 0;
// the version of javascript supported
var jsVersion = 1.0;
// -----------------------------------------------------------------------------

//print out the VB function VBGetSwfVer
 document.write(
'<scr' + 'ipt language=\"VBScript\" type=\"text/vbscript\">' + '\n' +
	'Function VBGetSwfVer(i)' + '\n' +
	  'on error resume next' + '\n' +
	  'Dim swControl, swVersion' + '\n' +
	  'swVersion = 0' + '\n' +
	   ' set swControl = CreateObject("ShockwaveFlash.ShockwaveFlash." + CStr(i))' + '\n' +
	  'if (IsObject(swControl)) then' + '\n' +
	   'swVersion = swControl.GetVariable("$version")' + '\n' +
	  'end if' + '\n' +
	  'VBGetSwfVer = swVersion' + '\n' +
	'End Function' + '\n' +
'<\/sc' + 'ript>'
);


// Detect Client Browser type
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
jsVersion = 1.1;
// JavaScript helper required to detect Flash Player PlugIn version information
function JSGetSwfVer(i){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
      		var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			descArray = flashDescription.split(" ");
			tempArrayMajor = descArray[2].split(".");
			versionMajor = tempArrayMajor[0];
			versionMinor = tempArrayMajor[1];
			if ( descArray[3] != "" ) {
				tempArrayMinor = descArray[3].split("r");
			} else {
				tempArrayMinor = descArray[4].split("r");
			}
      		versionRevision = tempArrayMinor[1] > 0 ? tempArrayMinor[1] : 0;
            flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
      	} else {
			flashVer = -1;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	// Can't detect in all other cases
	else {
		
		flashVer = -1;
	}
	return flashVer;
} 
// If called with no parameters this function returns a floating point value 
// which should be the version of the Flash Player or 0.0 
// ex: Flash Player 7r14 returns 7.14
// If called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) 
{
 	reqVer = parseFloat(reqMajorVer + "." + reqRevision);
   	// loop backwards through the versions until we find the newest version	
	for (i=25;i>0;i--) {	
		if (isIE && isWin && !isOpera) {
			versionStr = VBGetSwfVer(i);
		} else {
			versionStr = JSGetSwfVer(i);		
		}
		if (versionStr == -1 ) { 
			return false;
		} else if (versionStr != 0) {
			if(isIE && isWin && !isOpera) {
				tempArray         = versionStr.split(" ");
				tempString        = tempArray[1];
				versionArray      = tempString .split(",");				
			} else {
				versionArray      = versionStr.split(".");
			}
			versionMajor      = versionArray[0];
			versionMinor      = versionArray[1];
			versionRevision   = versionArray[2];
			
			versionString     = versionMajor + "." + versionRevision;   // 7.0r24 == 7.24
			versionNum        = parseFloat(versionString);
        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
			if ( (versionMajor > reqMajorVer) && (versionNum >= reqVer) ) {
				return true;
			} else {
				return ((versionNum >= reqVer && versionMinor >= reqMinorVer) ? true : false );	
			}
		}
	}	
	return (reqVer ? false : 0.0);
}


var hasRightVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision);

//For testing
//alert(FlashVars);

//Shove this in your header: <script type="text/javascript" src="/js/flash_detect.js"></script>
//Example Code - > <script language="JavaScript">showFlash('homeFlash','415','178','no','Sandtoft Roof Tiles');</script>

function showFlash(MovieName,MovieWidth,MovieHeight,showFlash,sTitle)
{
	if (hasRightVersion && showFlash == "yes") // if we've detected an acceptable version and function says show the flash
	{

		// ######## UPDATE THESE VARIABLES TO POINT TO YOUR FLASH .SWF FILE ########
		//version set at top
		var MovieQuality = "high";							//Quality of Flash movie. Values can be "best", "high", "medium", "low"
		var MovieBgColor = "transparent";						//Background hex color of movie
		var MovieMenu = "false";							//Toggles menu (when right clicked on movie)
		var MoviePlay = "true";							//Toggles play
		var MovieLoop = "true";							//Toggles loop
		var MovieWmode = "transparent";					//sets wmode

		document.write(
			'\n' + '<div class="'+ MovieName +'" title="'+ sTitle +'">'
			+ '\n\t' + '<object  id="'+ MovieName +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + 'width="' + MovieWidth + '" height="' + MovieHeight + '"' + 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">'
		    + '\n\t\t' + '<param name="movie" value="/flash/'+ MovieName +'.swf" />'
		    + '\n\t\t' + '<param name="menu" value="'+ MovieMenu +'" />'
		    + '\n\t\t' + '<param name="quality" value="'+ MovieQuality +'" />'
		    + '\n\t\t' + '<param name="bgcolor" value="'+ MovieBgColor +'" />'
		    + '\n\t\t' + '<param name="play" value="'+ MoviePlay +'">'
		    + '\n\t\t' + '<param name="loop" value="'+ MovieLoop +'">'
		    + '\n\t\t' + '<param name="wmode" value="'+ MovieWmode +'">'
		    + '\n\t\t' + '<embed src="/flash/'+ MovieName +'.swf" menu="'+ MovieMenu +'" quality="'+ MovieQuality +'" bgcolor="'+ MovieBgColor +'" width="' + MovieWidth + '" height="' + MovieHeight + '" name="'+ MovieName +'" play="'+ MoviePlay +'" loop="'+ MovieLoop +'" wmode="'+ MovieWmode +'" quality="'+ MovieQuality +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed>'
		    + '\n\t' + '</object>'
			+ '\n' + '</div>'
		);

	}
	else  // flash is too old or we can't detect the plugin or function says don't show the flash
	{
		document.write(
			'\n' + '<div><br />This page requires a flash plugin to work correctly, if you wish to download this plugin please <a href="http://www.macromedia.com/go/getflashplayer/" target="_blank" title="Click here to download flash player plugin">click here</a><br />&nbsp;</div>'
			+ '\n' + '<div>If you do not wish to download the flash plugin, please use the map below to continue searching for properties:<br />&nbsp;</div>'
			+ '\n' + '<div><img src="/images/property_search_map.gif" width="412" height="354" alt="Please select an area to make a search" border="0" usemap="#map" /></div>'
			+ '\n' + '<map name="map" id="map">'
			+ '\n\t' + '<area alt="Search the Leeds Area" shape="poly" coords="141,31,222,31,240,16,255,14,263,26,264,61,254,62,254,66,264,78,260,96,265,107,263,111,256,117,237,124,222,124,216,120,211,120,208,123,207,125,203,122,198,125,188,135,186,131,182,126,171,124,166,114,153,108,166,102,165,96,149,96,146,76,152,61,146,55,135,55,131,55,119,45,120,41,125,40,132,44,137,45,143,44" href="/housing/property-search/leeds.html?location=Leeds">'
			+ '\n\t' + '<area alt="Search the Bradford Area" shape="poly" coords="142,31,95,9,78,13,72,30,72,41,55,56,49,65,43,73,46,76,60,82,68,93,74,95,90,96,99,95,101,97,99,111,103,115,111,108,118,104,123,108,126,114,128,120,135,119,148,105,154,107,167,101,166,96,150,96,147,74,153,61,147,55,133,55,121,45,121,39,126,39,134,45,143,44" href="/housing/property-search/bradford.html?location=Bradford">'
			+ '\n\t' + '<area alt="Search the Wakefield Area" shape="poly" coords="261,113,290,123,293,127,280,134,280,138,280,151,281,162,289,167,290,169,285,174,281,177,278,185,276,189,271,192,263,194,258,193,252,198,249,186,242,180,238,183,230,182,222,178,202,187,189,181,171,173,173,162,181,156,175,148,178,143,176,138,186,131,189,135,202,122,206,122,208,126,213,120,219,120,222,124,241,124" href="/housing/property-search/wakefield.html?location=Wakefield">'
			+ '\n\t' + '<area alt="Search the Calderdale Area" shape="poly" coords="45,74,26,89,23,111,11,130,19,144,32,151,47,145,49,149,47,169,55,179,73,170,79,167,82,164,83,163,96,162,121,143,139,142,140,129,128,120,119,105,118,104,104,114,99,111,101,98,98,95,94,95,84,96,69,94,61,83" href="/housing/property-search/calderdale.html?location=Calderdale">'
			+ '\n\t' + '<area alt="Search the Kirklees Area" shape="poly" coords="57,178,88,211,113,224,125,216,139,216,146,202,150,207,170,205,176,198,187,180,171,174,173,161,180,155,175,148,178,142,174,138,187,132,182,126,172,124,166,114,149,105,136,118,130,120,139,128,139,142,121,142,96,162,83,163" href="/housing/property-search/kirklees.html?location=Kirklees">'
			+ '\n\t' + '<area alt="Search the Barnsley Area" shape="poly" coords="113,224,122,231,123,241,140,244,144,238,144,234,148,233,194,243,197,248,192,260,202,261,210,239,221,242,225,240,229,240,240,226,272,227,272,224,268,214,268,209,252,198,249,186,242,180,237,184,222,178,204,187,189,181,172,204,150,206,146,202,139,216,124,216" href="/housing/property-search/barnsley.html?location=Barnsley">'
			+ '\n\t' + '<area alt="Search the Sheffield Area" shape="poly" coords="123,242,136,254,135,268,148,274,161,285,162,300,176,307,168,320,175,322,186,319,194,327,199,328,210,318,219,323,223,319,222,312,238,311,241,319,250,324,260,317,257,302,240,289,239,271,222,259,223,250,222,243,221,240,212,240,202,259,192,259,196,248,194,244,145,233,140,244" href="/housing/property-search/sheffield.html?location=Sheffield">'
			+ '\n\t' + '<area alt="Search the Rotherham Area" shape="POLY" coords="259,316,266,314,273,328,290,334,315,312,314,308,306,305,320,288,320,280,312,271,309,265,282,265,279,261,279,238,277,236,271,241,266,242,265,236,257,226,239,227,231,240,223,241,222,260,240,273,239,289,257,303" href="/housing/property-search/rotherham.html?location=Rotherham">'
			+ '\n\t' + '<area alt="Search the Doncaster Area" shape="poly" coords="290,169,330,155,377,154,392,165,385,183,389,216,383,219,370,216,368,218,375,231,371,237,357,247,355,259,350,266,331,268,320,280,308,265,282,265,279,261,279,238,276,236,267,242,258,228,272,227,268,216,268,209,251,197,259,193,271,194,276,188,282,177" href="/housing/property-search/doncaster.html?location=Doncaster">'
			+ '\n' + '</map>'
		);

	}
}