/*Author: Matthew La Rouche
These scripts contain the functionality for the popup window and the call back to the openning window.
They also containt scripts which "write" the buttons and links that this JS controls, otherwise
they do not appear.  I.e. noscript = noshow/different
*/

function writeCloseButton(){
	/*test for the objects before trying to use them*/
	if ((document) && (document.write) && (window) && (window.close)){
		document.write("<a id=\"closeButton\" href=\"Javascript: window.close();\"></a>");
	}
}

function writeLogoMap(){
	if ((document) && (document.write) && (window) && (window.close)){
		document.write("<map name=\"logoM\" id=\"logoM\">\n<area shape=\"rect\" coords=\"-2,-2,190,75\" alt=\"FABU - Marketing\" title=\"FABU - Marketing\" href=\"Javascript: openInParent('../index.php');\" />\n</map>");
	}
}

function writeLogosMap(){
	if ((document) && (document.write) && (window) && (window.close)){
		document.write("<map name=\"logosM\" id=\"logosM\">\n<area shape=\"rect\" coords=\"514,0,587,85\" alt=\"www.fabu.com\" title=\"www.fabu.com\" href=\"Javascript: openInParent('http://www.fabu.com');\" />\n<area shape=\"rect\" coords=\"380,0,474,85\" alt=\"www.getdiners.com\" title=\"www.getdiners.com\" href=\"Javascript: openInParent('http://www.getdiners.com');\" />\n<area shape=\"rect\" coords=\"257,0,350,85\" alt=\"www.fabudaily.com\" title=\"www.fabudaily.com\" href=\"Javascript: openInParent('http://www.fabudaily.com');\" />\n<area shape=\"rect\" coords=\"119,0,246,85\" alt=\"www.fabuloussavings.com\" title=\"www.fabuloussavings.com\" href=\"Javascript: openInParent('http://www.fabuloussavings.com')\" />\n<area shape=\"rect\" coords=\"-2,0,113,85\" alt=\"www.fabumarketing.com/getbusiness\" title=\"www.fabumarketing.com/getbusiness\" href=\"Javascript: openInParent('../getbusiness/index.php');\" />\n</map>");
	}
}


function writeFootLinks(){
	if ((document) && (document.write) && (window) && (window.close)){
		document.write("<a class=\"footer\" href=\"Javascript: openInParent('../sitemap/index.php');\">Site Map</a> | <a class=\"footer\" href=\"Javascript: openInParent('../contactus/index.php');\">Contact Us</a>");
	}
}

function openInParent(whatUrl){
	//alert (whatUrl);
	if (window.opener && !window.opener.closed) {
		window.opener.location = whatUrl;
		self.close();
		/*
		NOTES:
		FF will not close the window if the location is incorrect/doesn't exist
		IE7 will close the window but may prompt the user first
		IE6 always closes the window
		*/
	}
}