//-------------------------------------------------------------------------------------
// File        : GF Embedding.js
// Description : Code for embedding menus and flash elements
//
//--------------------- GeckoFoot Limited COPYRIGHT © 2006 ----------------------------
// The  information  contained here-in is the property of GeckoFoot Limited and
// is not to be copied, altered or used without prior permission. All rights reserved. 
//-------------------------------------------------------------------------------------

function gfembedflash ( src, width, height )
{
	flashStr = new String ( "<object  classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"" + width + "\" height=\"" + height + "\" class=\"leftObject\"><param name=\"movie\" value=\"" ) ;
	flashStr += src ;
	flashStr += "\"<param name=\"quality\" value=\"high\" /><param name=\"allowScriptAccess\" value=\"always\">\n <embed src=\"" ;
	flashStr += src ;
	flashStr += "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + width + "\" height=\"" + height + "\" allowScriptAccess=\"always\"></embed></object>" ;
	document.write ( flashStr ) ;
}

function gfembedflashnofloat ( src, width, height )
{
	flashStr = new String ( "<object  classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"" + width + "\" height=\"" + height + "\" class=\"noFloat\"><param name=\"movie\" value=\"" ) ;
	flashStr += src ;
	flashStr += "\"<param name=\"quality\" value=\"high\" /><embed src=\"" ;
	flashStr += src ;
	flashStr += "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + width + "\" height=\"" + height + "\"></embed></object>" ;
	document.write ( flashStr ) ;
}

function gfembedpaddedflash ( src, width, height )
{
	flashStr = new String ( "<object  classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"" + width + "\" height=\"" + height + "\" class=\"paddedObject\"><param name=\"movie\" value=\"" ) ;
	flashStr += src ;
	flashStr += "\"<param name=\"quality\" value=\"high\" /><embed src=\"" ;
	flashStr += src ;
	flashStr += "\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + width + "\" height=\"" + height + "\"></embed></object>" ;
	document.write ( flashStr ) ;
}

function gfembedtopmenu ( img, tint, head, url, i1, u1, i2, u2, i3, u3 )
{
	gfembedflash ( "Multimedia/GF Pic " + /*Top */ "Menu.swf?imgSrc=" + img + "&tint=" + tint + "&headline=" + head + "&mainURL=" + url + "&item1text=" + i1 + "&item1URL=" + u1 + "&item2text=" + i2 + "&item2URL=" + u2 + "&item3text=" + i3 + "&item3URL=" + u3, 140, 110 ) ;
}

/*
Copyright (c) Copyright (c) 2007, Carl S. Yestrau All rights reserved.
Code licensed under the BSD License: http://www.featureblend.com/license.txt
Version: 1.0.3
*/
var FlashDetect = new function(){
	var self = this;
	self.installed = false;
	self.raw = "";
	self.major = -1;
	self.minor = -1;
	self.revision = -1;
	self.revisionStr = "";
	var activeXDetectRules = [
		{
			"name":"ShockwaveFlash.ShockwaveFlash.7",
			"version":function(obj){
				return getActiveXVersion(obj);
			}
		},
		{
			"name":"ShockwaveFlash.ShockwaveFlash.6",
			"version":function(obj){
				var version = "6,0,21";
				try{
					obj.AllowScriptAccess = "always";
					version = getActiveXVersion(obj);
				}catch(err){}
				return version;
			}
		},
		{
			"name":"ShockwaveFlash.ShockwaveFlash",
			"version":function(obj){
				return getActiveXVersion(obj);
			}
		}
	];
	var getActiveXVersion = function(activeXObj){
		var version = -1;
		try{
			version = activeXObj.GetVariable("$version");
		}catch(err){}
		return version;
	};
	var getActiveXObject = function(name){
		var obj = -1;
		try{
			obj = new ActiveXObject(name);
		}catch(err){}
		return obj;
	};
	var parseActiveXVersion = function(str){
		var versionArray = str.split(",");//replace with regex
		return {
			"raw":str,
			"major":parseInt(versionArray[0].split(" ")[1], 10),
			"minor":parseInt(versionArray[1], 10),
			"revision":parseInt(versionArray[2], 10),
			"revisionStr":versionArray[2]
		};
	};
	var parseStandardVersion = function(str){
		var descParts = str.split(/ +/);
		var majorMinor = descParts[2].split(/\./);
		var revisionStr = descParts[3];
		return {
			"raw":str,
			"major":parseInt(majorMinor[0], 10),
			"minor":parseInt(majorMinor[1], 10), 
			"revisionStr":revisionStr,
			"revision":parseRevisionStrToInt(revisionStr)
		};
	};
	var parseRevisionStrToInt = function(str){
		return parseInt(str.replace(/[a-zA-Z]/g, ""), 10) || self.revision;
	};
	self.majorAtLeast = function(version){
		return self.major >= version;
	};
	self.FlashDetect = function(){
		if(navigator.plugins && navigator.plugins.length>0){
			var type = 'application/x-shockwave-flash';
			var mimeTypes = navigator.mimeTypes;
			if(mimeTypes && mimeTypes[type] && mimeTypes[type].enabledPlugin && mimeTypes[type].enabledPlugin.description){
				var version = mimeTypes[type].enabledPlugin.description;
				var versionObj = parseStandardVersion(version);
				self.raw = versionObj.raw;
				self.major = versionObj.major;
				self.minor = versionObj.minor; 
				self.revisionStr = versionObj.revisionStr;
				self.revision = versionObj.revision;
				self.installed = true;
			}
		}else if(navigator.appVersion.indexOf("Mac")==-1 && window.execScript){
			var version = -1;
			for(var i=0; i<activeXDetectRules.length && version==-1; i++){
				var obj = getActiveXObject(activeXDetectRules[i].name);
				if(typeof obj == "object"){
					self.installed = true;
					version = activeXDetectRules[i].version(obj);
					if(version!=-1){
						var versionObj = parseActiveXVersion(version);
						self.raw = versionObj.raw;
						self.major = versionObj.major;
						self.minor = versionObj.minor; 
						self.revision = versionObj.revision;
						self.revisionStr = versionObj.revisionStr;
					}
				}
			}
		}
	}();
};
FlashDetect.release = "1.0.3";

function gfembedmenu ( img, tint, head, url, i1, u1, i2, u2, i3, u3, rootDir )
{
	if ( !FlashDetect.installed )
	{
		html = "<table width=140 height=110 background='" + img + "'><tr><td valign='bottom'>";
		html = html + "<table background='Images/MenuShade.png' width='100%' class='menuTable'>";
		html = html + "<tr><td><a href='" + url + "'>" + head + "</a></td></tr>";
		html = html + "<tr><td><a href='" + u1 + "'>"  + i1 + "</a></td></tr>";
		html = html + "<tr><td><a href='" + u2 + "'>"  + i2 + "</a></td></tr>";
		html = html + "<tr><td><a href='" + u3 + "'>"  + i3 + "</a></td></tr>";
		html = html + "</table></td></tr></table>";
		document.write ( html );
	}
	else
	{
		gfembedflash ( "http://www.geckofoot.com/Multimedia/GF Pic Menu.swf?imgSrc=" + img + "&tint=" + tint + "&headline=" + head + 
				  "&mainURL=" + url + "&item1text=" + i1 + "&item1URL=" + u1 + "&item2text=" + i2 + 
				  "&item2URL=" + u2 + "&item3text=" + i3 + "&item3URL=" + u3,
				  140, 110 ) ;
	}
}

function gfembedsearch ()
{
	if ( FlashDetect.installed )
	{
		gfembedflash ( "http://www.geckofoot.com/Multimedia/GF Menu Bottom.swf", 140, 70 ) ;
	}
	else
	{
		document.write ( "<img src='Images/Menu Empty Search.jpg'/><br/>" );
	}
}

function gfembednews ( img, tint, headline, detail, urlLink, rootDir )
{
	gfembedpaddedflash ( rootDir + "Multimedia/GF News.swf?imgSrc=" + img + "&tint=" + tint + 
		"&headline=" + headline + "&detail=" + detail + "&urlLink=" + urlLink, 
		140, 140 ) ;
}


function gfembednewsnopad ( img, tint, headline, detail, urlLink, rootDir )
{
	gfembedflash ( rootDir + "Multimedia/GF News.swf?imgSrc=" + img + "&tint=" + tint + 
		"&headline=" + headline + "&detail=" + detail + "&urlLink=" + urlLink, 
		140, 140 ) ;
}

function gfembedrss ( rssURL, tint, rootDir, img )
{
	gfembedpaddedflash ( rootDir + "Multimedia/GF News XML.swf?rssURL=" + rssURL + 
		"&rootDirectory=" + rootDir + "&tint=" + tint + "&imgSrc=" + img, 140, 140 ) ;
}

function GFEmbedRSS ( rssURL, tint, backCol, img )
{
	gfembedpaddedflash ( "http://www.PimpUpYourSite.com/Multimedia/GF News XML.swf?rssURL=" + rssURL + 
		"&rootDirectory=http://www.GeckoFoot.com/&backCol=" + backCol + "&tint=" + tint +
		"&imgSrc=" + img, 140, 140 ) ;
}

function gfembedrssnopad ( rssURL, tint, rootDir, img )
{
	gfembedflash ( rootDir + "Multimedia/GF News XML.swf?rssURL=" + rssURL + 
		"&rootDirectory=" + rootDir + "&tint=" + tint + "&imgSrc=" + img, 140, 140 ) ;
}

function gfembedsidemenu ( rootDir )
{	
	gfembedmenu ( rootDir + "Images/140x110_Home.jpg", "0x550000",
				  "Home",               rootDir + "index.shtml",
				  "Login to Services",  "http://services.GeckoFoot.com",
				  "PimpUpYourSite.com", "http://www.PimpUpYourSite.com",
				  "Introduction",       rootDir + "intro.shtml", rootDir ) ;
	document.write ( "<img src=\"" + rootDir + "Images/Menu Middle.jpg\" width=\"140\" height=\"15\" />" ) ;

	gfembedmenu ( rootDir + "Images/140x110_Services.jpg",     "0x005500",
				  "Services and Solutions", rootDir + "intro.shtml",
				  "Software Solutions",     rootDir + "SoftwareSolutions.shtml",
				  "Web Solutions", 			rootDir + "WebSolutions.shtml",
				  "Media Solutions", 	rootDir + "MediaSolutions.shtml", rootDir ) ;
	document.write ( "<img src=\"" + rootDir + "Images/Menu Middle.jpg\" width=\"140\" height=\"15\" />" ) ;

	gfembedmenu ( rootDir + "Images/140x110_About.jpg", 	"0x000055", 
				  "About Us", 				    rootDir + "AboutUs.shtml",
				  "News", 	    	            rootDir + "News",
				  "Company Profile", 	 	    rootDir + "CompanyProfile.shtml",
				  "Contact Us", 			    rootDir + "ContactUs.shtml", rootDir ) ;

	gfembedsearch ();
	
	document.write ( "<img name='MenuBottom' src='" + rootDir + "Images/Menu%20Bottom.jpg' " +
						"width='140' height='126' border='0' id='MenuBottom' " +
						"usemap='#m_Menu20Bottom' alt='' /> " +
					"<map name='m_Menu20Bottom' id='m_Menu20Bottom'> " +
						"<area shape='circle' coords='15,17,14' " +
							"href='mailto:info@geckofoot.com' alt='E-mail Us' /> " +
					"<area shape='circle' coords='15,46,14' href='" + rootDir + "Help.shtml' " + 
					"alt='Website Help' /> " +
					"<area shape='circle' coords='15,75,14' href='" + rootDir + "Copyright.shtml' " +
					"alt='&copy; 2009 GeckoFoot Limited' /> </map>" ) ;	
}



function gfembedcurrentnews ( rootDir )
{
    gfembednews ( rootDir + "Images/Scan 1 Tiny.JPG", "0x555500", 
				  "BarStock Ready...",
				  //"GeckoFoot BarStock", 
				  "Our Bar Stocktaking system is released for trials with key customers/distributors.",
				  rootDir + "News/BarStock.shtml", rootDir ) ;
    /*gfembednews ( rootDir + "Images/Max.jpg", "0x005555", 
				  "Multimedia Manex", 
				  "Manex brings Photographic, Film and Media talent to the GeckoFoot offering.",
				  rootDir + "News/MatineeClub.html", rootDir ) ;*/
    gfembednews ( "http://www.PimpUpYourSite.com/Images/Pimp140.jpg", "0x550033", 
				  "PimpUpYourSite.com", 
				  "Use GeckoFoot's controls on your site for free - visit our new site 'PimpUpYourSite.com'",
				  "http://www.PimpUpYourSite.com/", rootDir ) ;
	gfembednews ( rootDir + "Images/Emma.jpg", "0x550000", 
				  "Modernising Matinee", //&eacute;
				  "GeckoFoot win contract to develop new website for rebranded retro pop group 'Matinee Club'.",//&eacute;
				  rootDir + "News/MatineeClub.shtml", rootDir ) ;
    gfembednews ( "http://www.LymeHarbour.co.uk/Images/LymeHarb140.jpg", "0x000055", 
				  "LymeHarbour Launch", 
				  "We announce the launch of a new website for the users of Lyme Regis Harbour.",
				  rootDir + "News/LymeHarbour.shtml", rootDir ) ;
}

function gfembedmenuabove ( rootDir )
{
  	gfembedtopmenu ( rootDir + "Images/Foot 2.jpg", "0x550000",
				  "Home",               rootDir + "index.shtml",
				  "Login to Services",  "http://services.GeckoFoot.com",
				  "PimpUpYourSite.com", "http://www.PimpUpYourSite.com",
				  "Introduction",           rootDir + "intro.shtml" ) ;
	document.write ( "<img src='Images/Menu Top Sep.jpg' width='5' height='110' />" ) ;
	gfembedtopmenu ( "Images/140x110_Services.jpg",     "0x005500",
				  "Services and Solutions", rootDir + "ServicesAndSolutions.shtml",
				  "Software Solutions",     rootDir + "SoftwareSolutions.shtml",
				  "Web Solutions", 			rootDir + "WebSolutions.shtml",
				  "Media Solutions",        rootDir + "SoftwareSolutions.shtml" ) ;
	document.write ( "<img src='Images/Menu Top Sep.jpg' width='5' height='110' />" ) ;
	gfembedtopmenu ( "Images/140x110_About.jpg", 	"0x000055", 
				  "About Us", 				    rootDir + "AboutUs.shtml",
				  "News", 	    	            rootDir + "News",
				  "Company Profile", 	 	    rootDir + "CompanyProfile.shtml",
				  "Contact Us", 			    rootDir + "ContactUs.shtml" ) ;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function fbs_click()
{
	u=location.href;
	t=document.title;
	window.open ( 'http://www.facebook.com/sharer.php?u='+encodeURIComponent(u)+'&t='+encodeURIComponent(t),'sharer','toolbar=0,status=0,width=626,height=436');
	//return false;
}

function delicious_click ()
{
	window.open ( 'http://delicious.com/save?url='+encodeURIComponent(window.location.href)+'&title='+encodeURIComponent(document.title)+'&v=5&jump=yes','sharer','toolbar=0,status=0,width=850,height=600' );
}

function create_bookmark ()
{

 title = document.title; 
 url = location.href;

	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( url, title); }
	else if(window.opera && window.print) { // Opera Hotlist
		return true; }
 }
 
function generalEnquiry ()
{
	newWin = window.open ( 'http://services.GeckoFoot.com/Contact.aspx?client=gfadmin&title=General Enquiry&opt2=I am interested in your Media Services&opt1=I am interested in your Web Solutions&opt3=I am interested in your Software Solutions&opt4=I have another Enquiry&txt1=Company Name (opt)&txt2=Phone Number (opt)&txt3=Subject&txtBlock=Description&redirect=http://www.geckofoot.com/ThankYou.html','','width=500,height=620,location=0,top=' + ( ( screen.availHeight - 600 ) / 3 ) + ',left=' + ( ( screen.availWidth - 430 ) / 2 ) );
}

function mediaEnquiry ()
{
	newWin = window.open ( 'http://services.GeckoFoot.com/Contact.aspx?client=gfadmin&title=Media Enquiry&opt2=I am interested in arranging a photo shoot&opt1=I would like logos or banners created from existing pictures&opt3=I am interested in creating a film, advert or showreel&opt4=I have another requirement&txt1=Company Name (opt)&txt2=Phone Number (opt)&txt3=Subject&txtBlock=Description&redirect=http://www.geckofoot.com/ThankYou.html','','width=500,height=620,location=0,top=' + ( ( screen.availHeight - 600 ) / 3 ) + ',left=' + ( ( screen.availWidth - 430 ) / 2 ) );
}

function webEnquiry ()
{
	newWin = window.open ( 'http://services.GeckoFoot.com/Contact.aspx?client=gfadmin&title=Web Enquiry&opt1=I am interested in a dynamic flash based website&opt2=I need a HTML based site with some dynamic content&opt3=I have an existing site which I need help with&opt4=I have another requirement&txt1=Company Name (opt)&txt3=Subject&txt2=Existing Website (opt)&txtBlock=Description&redirect=http://www.geckofoot.com/ThankYou.html','','width=500,height=620,location=0,top=' + ( ( screen.availHeight - 600 ) / 3 ) + ',left=' + ( ( screen.availWidth - 430 ) / 2 ) );
}

function softwareEnquiry ()
{
	newWin = window.open ( 'http://services.GeckoFoot.com/Contact.aspx?client=gfadmin&title=Software Enquiry&opt1=I am interested in having some bespoke software written for us&opt2=I have an idea for new software which I could sell in my industry&opt3=We develop software in-house but need help updating our skillset&opt4=I have another requirement&txt1=Company Name (opt)&txt2=Subject&txtBlock=Description&redirect=http://www.geckofoot.com/ThankYou.html','','width=500,height=600,location=0,top=' + ( ( screen.availHeight - 600 ) / 3 ) + ',left=' + ( ( screen.availWidth - 430 ) / 2 ) );
}
