/**
  *	 JAVASCRIPT PLUGIN TO GATHER GLOBALID FROM USER...
  *	HOW TO USE::
  *	- drop this file into your javascript library in your application and ensure that you are also using the jQuery library...
  *	 	(this is not essential, but makes life a lot easier...)
  *	- from your 'jQuery functions script, call the 'getInboxTagGID()' method and a cookie will be written to the client's 
  *	   machine that can then be pulled into your PHP application (or any other language) for use there.
  *	- Note: cookie is set by default to expire in 1 year.
  **/

function outputGlobalID( id )
{
	
	var date = new Date();
	
	date.setTime(date.getTime()+(365*24*60*60*1000));
	var expires = "; expires=" + date.toGMTString();
	document.cookie="taggid=" + id + expires + "; path=/";
}

function getGlobalIDCookie()
{
		var c_start = document.cookie.indexOf("taggid");

   		if (c_start!=-1)
    	{
    		c_start=c_start + 7;
    		var c_end=document.cookie.indexOf(";",c_start);
    		if (c_end==-1) c_end=document.cookie.length;
    		return unescape(document.cookie.substring(c_start,c_end));
	    }

		return null;
}


getInboxTagGID = function(){
	var gid = getGlobalIDCookie();
	if ( gid === null)
  	{
  		document.write('<object codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" name="banner" width="1" height="1" align="middle" id="banner" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" ><param name="movie" value="http://www.inboxtag.com/tag.swf?returnString=javaGlobalId" /><param name="quality" value="high" /> <param name="bgcolor" value="#ffffff" /><param name="allowscriptaccess" value="crossDomain" /><param name="allowfullscreen" value="false" /><embed src="http://www.inboxtag.com/tag.swf?returnString=javaGlobalId" quality="high" bgcolor="#ffffff" width="1" height="1" name="banner" align="middle" allowscriptaccess="crossDomain" allowfullscreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object>');
	}
}
