//-------------------------------------------------------------------------------------
// 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. 
//-------------------------------------------------------------------------------------

// New Cookie Functions
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires;//+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}


function GFGetFlashString ( src, width, height, className )
{
	flashStr = new String ( "<object  classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"" ) ;
	flashStr +=	width + "\" height=\"" + height + "\" class=\"" + className + "\">\n  <param name=\"movie\" value=\"" ;
	flashStr += src ;
	flashStr += "\"/>\n <param name=\"allowScriptAccess\" value=\"always\">\n <param name=\"quality\" value=\"high\" />\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>" ;
	return ( flashStr ) ;
}


function GFEmbedFlash ( src, width, height, className )
{
	document.write ( GFGetFlashString ( src, width, height, className ) ) ;
}

function gfembedflash ( src, width, height )
{
	document.write ( GFGetFlashString ( src, width, height, "leftObject" ) ) ;
}

function gfembedpaddedflash ( src, width, height )
{
	document.write ( GFGetFlashString ( src, width, height, "paddedObject" ) ) ;
}

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 ) ;
}

function gfembedmenu ( img, tint, head, url, i1, u1, i2, u2, i3, u3, rootDir )
{
	if ( readCookie ( "GFHTMLOnly" ) == "On" )
	{
		document.write ( "" );
	}
	else
	{
		gfembedflash ( rootDir + "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,
					  138, 110 ) ;
	}
}

function GFEmbedMenu ( img, tint, head, url, i1, u1, i2, u2, i3, u3, userKey, className )
{
	GFEmbedFlash ( "http://www.PimpUpYourSite.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 + "&userKey=" + userKey,
				  138, 110, className ) ;
}

function GFEmbedNews ( img, tint, headline, detail, urlLink, userKey, className )
{
	GFEmbedFlash ( "http://www.PimpUpYourSite.com/Multimedia/GF News.swf?imgSrc=" + img + "&tint=" + tint + 
		"&headline=" + headline + "&detail=" + detail + "&urlLink=" + urlLink + "&userKey=" + userKey,
				  140, 140, className ) ;
}

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, userKey, className )
{
	GFEmbedFlash ( "http://www.PimpUpYourSite.com/Multimedia/GF News XML.swf?tint=" + tint +
		"&rssURL=" + rssURL + 
		"&rootDirectory=http://www.PimpUpYourSite.com/&backCol=" + backCol + "&imgSrc=" + img + "&userKey=" + userKey, 140, 140, className ) ;
}

function gfembedrssnopad ( rssURL, tint, rootDir, img )
{
	gfembedflash ( rootDir + "Multimedia/GF News XML.swf?rssURL=" + rssURL + 
		"&rootDirectory=" + rootDir + "&tint=" + tint + "&imgSrc=" + img, 140, 140 ) ;
}

function GFGetPimpLink ()
{
	var params = "imgSrc=http://www.PimpUpYourSite.com/Images/GreenPimp.jpg&tint=0x005500" + 
			  "&headline=Hover Menus&mainURL=http://www.PimpUpYourSite.com/HoverMenu.shtml&" +
			  "item1text=Configure Your Menu&item1URL=http://www.PimpUpYourSite.com/HoverMenu.shtml" ;
	params += "&item2text=Help for Controls&item2URL=http://www.GeckoFoot.com/Help.html"  + 
			  "&item3text=About Us&item3URL=http://www.GeckoFoot.com/AboutUs.html" ;
	var configureLink = "HoverMenu.shtml?" + params ;
	configureLink = escape ( configureLink ) ;
	return ( configureLink ) ;
}

function GFEmbedPimpMenu ()
{
	gfembedmenu ( "http://www.PimpUpYourSite.com/Images/GreenPimp.jpg", 0x005500, 
				  "Hover Menus", GFGetPimpLink (),  
				  "Configure Your Menu", GFGetPimpLink (),
				  "Help for Controls", "http://www.GeckoFoot.com/Help.html",
				  "About Us", "http://www.GeckoFoot.com/AboutUs.html", "" ) ;
}

function GFGetPimpNewsLink ()
{
	var params = "imgSrc=http://www.PimpUpYourSite.com/Images/PimpHat.jpg&tint=0x990000" + 
			  "&headline=Pop-up News&urlLink=http://www.PimpUpYourSite.com/PopupNews.shtml&" +
			  "detail=The pop-up news control provides a cool way to link to a single page. " +
			  "Click here to configure." ;
	var configureLink = "PopupNews.shtml?" + params ;
	configureLink = escape ( configureLink ) ;
	return ( configureLink ) ;
}

function GFEmbedPimpNews ()
{
   gfembednewsnopad  ( "http://www.PimpUpYourSite.com/Images/PimpHat.jpg", "0x990000", 
		"Pop-up News", 
		"The pop-up news control provides a cool way to link to a single page. Click here to configure.",
		GFGetPimpNewsLink (), "" ) ;
}

function GFGetPimpRSSLink ()
{
	var params = "rssURL=http://news.bbc.co.uk/rss/newsonline_uk_edition/front_page/rss.xml&" +
			     "tint=0x005555&backCol=0x000000&rootDirectory=http://www.PimpUpYourSite.com/&" +
				 "imgSrc=http://www.PimpUpYourSite.com/Images/UKMap.jpg"  ;
	var configureLink = "RSSViewer.shtml?" + params ;
	configureLink = escape ( configureLink ) ;
	return ( configureLink ) ;
}


function gfembedsidemenu ( rootDir )
{	
/*	document.write ( "<img src='" + rootDir + "Images/MenuTop1.jpg' alt='Home, Back, Switch to HTML' name='MenuTop1' width='52' height='120' " +
					  "border='0' align='top' usemap='#m_Menu20Top' id='MenuTop' />    " 
	document.write ( "<img src='" + rootDir + "Images/MenuTop2.jpg' alt='Site Title' " +
					 "name='MenuTop2' width='140' height='40' " +
					  "border='0' align='top' usemap='#m_Menu20Top' id='MenuTop' />" ) ;*/
	document.write ( "<img src='" + rootDir + "Images/FromGeckoFoot.jpg' " +
					 "name='MenuTop2' width='140' height='35' " +
					  "border='0' align='top' usemap='#m_Menu20Top' id='MenuTop' />" +
					 "<map name='m_Menu20Top' id='m_Menu20Top'>" +
					 "<area shape='rect' coords='15,8,121,29' href='http://www.GeckoFoot.com' alt='GeckoFoot.com' />" +
					 "</map><br>" ) ;
	gfembedmenu ( rootDir + "Images/PimpLinks.jpg", "0x000055",
				  "Services Home",       "http://services.GeckoFoot.com/",
				  "PimpUpYourSite.com",   rootDir,
				  "Visit GeckoFoot", 	 "http://www.GeckoFoot.com", 
				  "External Links",      rootDir + "Links.shtml",
				  rootDir ) ;
	document.write ( "<img src=\"" + rootDir + "Images/MenuBorderWB.jpg\" width=\"2\" height=\"110\" />" ) ;
	document.write ( "<img src=\"" + rootDir + "Images/Menu Middle.jpg\" width=\"140\" height=\"15\" />" ) ;

	gfembedmenu ( rootDir + "Images/CounterLinks.jpg",     "0x330033",
				  "Counters and Stats",     rootDir + "VisitorStatistics.shtml",
				  "Visitor Maps", 			"VisitorMap.aspx",
				  "Hit Counters", 		    "HitCounter.aspx",
				  "Image Protector",        "ImageProtector.aspx",
				  rootDir ) ;
	document.write ( "<img src=\"" + rootDir + "Images/MenuBorderWB.jpg\" width=\"2\" height=\"110\" />" +
					 "<img src=\"" + rootDir + "Images/Menu Middle.jpg\" width=\"140\" height=\"15\" />" ) ;

	gfembedmenu ( rootDir + "Images/FlashLinks.jpg",     "0x551111",
				  "Flash Controls",     	rootDir + "FlashControls.shtml",
				  "Hover Menu",       		rootDir + GFGetPimpLink (),
				  "Popup New", 			    rootDir + GFGetPimpNewsLink (),
				  "RSS News Viewer",   		rootDir + GFGetPimpRSSLink (),
				  rootDir ) ;
	/*gfembedmenu ( rootDir + "Images/Car.jpg",     "0x330033",
				  "Developer Links",     	    	"http://www.webmonkey.com/",
				  "W3 Schools", "http://www.w3schools.com/",
				  "Flash Developer's Kit", 		"http://www.flashkit.com/",
				  "Dev Guru",     				"http://www.devguru.com/",
				  rootDir ) ;*/
	document.write ( "<img src=\"" + rootDir + "Images/MenuBorderWB.jpg\" width=\"2\" height=\"110\" />" +
					 "<img src='" + rootDir + "Images/MenuEmptyBottom.jpg' " +
						"width='140' height='29' border='0' alt='' />" +
    				 "<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@PimpUpYourSite.com' alt='E-mail Us' /> " +
					"<area shape='circle' coords='15,46,14' href='http://www.GeckoFoot.com/Help.html' " + 
					"alt='Website Help' /> " +
					"<area shape='circle' coords='15,75,14' href='http://www.GeckoFoot.com/Copyright.html' " +
					"alt='&copy; 2007 GeckoFoot Limited' /> </map>" ) ;	
}

function gfembedcurrentnews ( rootDir )
{
	gfembednews ( rootDir + "Images/Emma.jpg", "0x550000", 
				  "Modernising Matin&eacute;e", 
				  "GeckoFoot win contract to develop new website for rebranded retro pop group 'Matin&eacute;e Club'.",
				  rootDir + "News/MatineeClub.html", rootDir ) ;
    gfembednews ( rootDir + "Images/Max.jpg", "0x005555", 
				  "Multimedia Manex", 
				  "Manex brings Photographic, Film and Media talent to the GeckoFoot offering.",
				  "", rootDir ) ;
    gfembednews ( "http://www.LymeHarbour.co.uk/Images/LymeHarb140.jpg", "0x000055", 
				  "LymeHarbour.co.uk Launch", 
				  "We announce the launch of a new website for the users of Lyme Regis Harbour.",
				  "", rootDir ) ;
}

function gfembedmenuabove ( rootDir )
{
  	gfembedtopmenu ( rootDir + "Images/Foot 2.jpg", "0x440000",
				  "Home",              rootDir + "index.html",
				  "News",        	   rootDir + "News/News.html",
				  "Site Map",          rootDir + "SiteMap.html",
				  "Contact Us",        rootDir + "ContactUs.html" ) ;
	document.write ( "<img src='Images/Menu Top Sep.jpg' width='10' height='110' />" ) ;
	gfembedtopmenu ( "Images/Variety.jpg",     "0x000044",
				  "Services and Solutions", "#",
				  "Web Solutions", 			rootDir + "WebSolutions.html",
				  "Software Solutions",     rootDir + "SoftwareSolutions.html",
				  "Media Solutions", 		rootDir + "MediaSolutions.html" ) ;
	document.write ( "<img src='Images/Menu Top Sep.jpg' width='10' height='110' />" ) ;
	gfembedtopmenu ( "Images/JimbAndMatinee.jpg", 	"0x004400", 
				  "About Us", 				    rootDir + "AboutUs.html",
				  "Company Profile", 	    	rootDir + "CompanyProfile.html",
				  "Associate Profiles", 	 	rootDir + "AssociateProfiles.html",
				  "Skills Profile", 			rootDir + "SkillsProfile.html" ) ;
}

function GFEmailVerify ( txt )
{ 
  return ( txt != "" &&
		   txt.indexOf ( '@' ) != -1 && 
		   txt.indexOf ( '.' ) != -1 && 
		   txt.length > 6 ) ;
} 