function handleError()
{
return true;
}
window.onerror = handleError;


//////////////////////////////////////////////////////////////////////////////////
var MM_FlashCanPlay=true;
var MM_contentVersion = 6;
var plugin = (navigator.mimeTypes && navigator.mimeTypes["application/x-shockwave-flash"]) ? navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin : 0;
if ( plugin ) {
		var words = navigator.plugins["Shockwave Flash"].description.split(" ");
	    for (var i = 0; i < words.length; ++i)
	    {
		if (isNaN(parseInt(words[i])))
		continue;
		var MM_PluginVersion = words[i]; 
	    }
	 MM_FlashCanPlay= MM_PluginVersion >= MM_contentVersion;
}
else if (navigator.userAgent && navigator.userAgent.indexOf("MSIE")>=0 && (navigator.appVersion.indexOf("Win") != -1)) {
	document.write('<SCR' + 'IPT LANGUAGE=VBScript\> \n'); //FS hide this from IE4.5 Mac by splitting the tag
	document.write('on error resume next \n');
	document.write('MM_FlashCanPlay = ( IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & MM_contentVersion)))\n');
	document.write('</SCR' + 'IPT\> \n');
	



}
/*
	if(!MM_FlashCanPlay)
	{
		/*
		var theItemToPlace="";
		theItemToPlace +='<div id="flashHolderCoverCover" onmouseover="showFlashCover(\'keepUp\')"  onmouseout="getReadyToHideFlashCover(\'whoWeAre\')" ></div>';
			theItemToPlace +='<div id="theCloseButt_MO" onmouseover="showFlashCover(\'keepUp\')"  onclick="getReadyToHideFlashCover(\'whoWeAre\')"  class="theCursorHand"><img src="RESOURCES/websiteFiles/Resouces/images/closeBtn.gif" border="0" /></div>';
			theItemToPlace +='<div id="contentHolderCont" onmouseover="showFlashCover(\'keepUp\')"><div class="contentHolder"><div class="contentTitle">';
    		theItemToPlace +='<p>We are people who specialise in <span id="yellow">social media marketing strategy</span> and who have the capability in-house to develop and implement the tools required. </p>';
    		theItemToPlace +='<p> We are recommended by Facebook and are members of their official Preferred Developer Consultant Programme.</p></div>';
			theItemToPlace +='<div class="addressText">39a Chobham Road<br />Woking<br />Surrey<br />GU21 6JD<br />United Kingdom </div>';
			theItemToPlace +='<div class="panoramHolder" id="right"><img src="RESOURCES/websiteFiles/Resouces/images/images/IMG_1490.jpg" width="346" height="115"/></div></div></div>';
			*//*
			
			//document.getElementById('flashHolderCover').innerHTML= theItemToPlace;
			document.getElementById('theLatestGamTweets').innerHTML= 'sugar sugar';	
	}
*/
/////////////////////////////////////////////////////////////////////////////////////


var params = {};
params.allowscriptaccess = "always";
params.wmode = "transparent";
var attributes = {  id: "theLogoGame",  name: "theLogoGame", quality: "high"};
				
var logoGameLocation="RESOURCES/websiteFiles/Resouces/swfs/logoGame2.swf";


swfobject.embedSWF(logoGameLocation, "flashHolderPERM", "650", "300", "8", false, {}, params, attributes);



//GLOBAL VARIABLES
var userId=null;
var theCommentsGain = new Object();
var theCloseMenuTimerId=null;
var keepMenuFlashCoverUp = false;
var theAjaxHttp=false;
var conAjaxHttp=false;
var whatClientsThinkTimer;
var fbCommentsScrollTimer;
var fadeInterval;
var pF_fadeInterval;
var fadeValue=10;
var pFoliofadeValue=10;
var pf_tableHeight=0;
var pf_tableWidth=0;

var theImg1 = new Image;
var theImg2 = new Image;
var theImg3 = new Image;
var theImg4 = new Image;
var	theImg5 = new Image;
var theImg6 = new Image;
var theImg7 = new Image;
var theImg8 = new Image;
var theImg9 = new Image;
var	theImg10 = new Image;
var theImg11 = new Image;
var theImg12 = new Image;
var theImg13 = new Image;


//AJAX FUNCTION
function getXMLHTTPRequest()
		{
			try{req=new XMLHttpRequest();}
	catch(err1){
		try{req=new ActiveXObject("Msxml2.XMLHTTP");}
		catch(err2){
			try{req=new ActiveXObject("Microsoft.XMLHTTP");}
		catch(err3){req=false;}
		}
		}
		return req;
		}
		
		

  window.fbAsyncInit = function() {
    FB.init({
      appId  : '114680788573946',//Gamaroff_Digital
	  logging : true,
      status : true, // check login status
      cookie : true,
	  session : null,// enable cookies to allow the server to access the session
      xfbml  : true  // parse XFBML
    });
  };

  (function() {
    var e = document.createElement('script');
    e.src = document.location.protocol + '//connect.facebook.net/en_GB/all.js';
    e.async = true;
    document.getElementById('fb-root').appendChild(e); 

  			}
  ());
  


function cacheMe()
{
	theImg1.src="RESOURCES/websiteFiles/Resouces/images/images/bg.gif";
	theImg2.src="RESOURCES/websiteFiles/Resouces/images/images/icons.jpg";
	theImg3.src="RESOURCES/websiteFiles/Resouces/images/images/IMG_1490.jpg";
	theImg4.src="RESOURCES/websiteFiles/Resouces/images/logos/images/clientLogo_01.gif";
	theImg5.src="RESOURCES/websiteFiles/Resouces/images/logos/images/clientLogo_02.gif";
	theImg6.src="RESOURCES/websiteFiles/Resouces/images/logos/images/clientLogo_03.gif";
	theImg7.src="RESOURCES/websiteFiles/Resouces/images/logos/images/clientLogo_04.gif";
	theImg8.src="RESOURCES/websiteFiles/Resouces/images/logos/images/clientLogo_05.gif";
	theImg9.src="RESOURCES/websiteFiles/Resouces/images/logos/images/clientLogo_06.gif";
	theImg10.src="RESOURCES/websiteFiles/Resouces/images/logos/images/clientLogo_07.gif";
	theImg11.src="RESOURCES/websiteFiles/Resouces/images/logos/images/clientLogo_08.gif";
	theImg12.src="RESOURCES/websiteFiles/Resouces/images/logos/images/clientLogo_09.gif";
	theImg13.src="RESOURCES/websiteFiles/Resouces/images/images/potfolio.jpg";
}


				
				

function bringInPOSTS()
{
	cacheMe();
	//document.getElementById('myTest').innerHTML="This works";

FB.api('/31574415784/posts', { limit: 25 },  function(response) {
	
	//document.getElementById('myTest').innerHTML=JSON.stringify(response);
	
									  
		var postToPlace="";
  
		for(var theResponseIncre=0; theResponseIncre<response['data'].length; theResponseIncre++){
			
				//if(response['data'][theResponseIncre].id=="31574415784_126302784055899"){document.getElementById('myTest').innerHTML=response['data'][theResponseIncre].message;}
			
			
			if(response['data'][theResponseIncre].description)
			{
				
			postToPlace +='<div id="fbprofilePic"><img src="RESOURCES/websiteFiles/Resouces/images/images/fbProfilePic.jpg" width="52" height="52" /></div>';
    	postToPlace +='<div id="fbPost"><b>'+response['data'][theResponseIncre].name+'</b><br />'+response['data'][theResponseIncre].description;
		postToPlace +='<span id="postAttach">';
		
		if(response['data'][theResponseIncre].picture){
		postToPlace +='<div><br /><a href="'+response['data'][theResponseIncre].link+'" target="_blank" ><img src="'+response['data'][theResponseIncre].picture+'" border="0" /></a></div>';
		}
		
		postToPlace +='</span>';
		var dateFirstPart=(response['data'][theResponseIncre].updated_time).substr(0,10);
		var dateSecPart = (response['data'][theResponseIncre].updated_time).substr(11,8);
		postToPlace +='<br /><br /><div id="createdAt">Date: '+dateFirstPart+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Time: '+dateSecPart+'</div><br />';
		postToPlace +='<div id="fbWhiteLikes">';
		postToPlace +='Likes';
		
		if(response['data'][theResponseIncre].likes){postToPlace +=': '+response['data'][theResponseIncre].likes;}
		else
		{postToPlace +=':  0';}
		
		postToPlace +=': ';//likes
		postToPlace +=' <span class="fbYellow">&#8226; </span>'; 
		postToPlace +='<span class="theCursorHand" onclick="seeThisComment('+theResponseIncre+')"> Comments: </span>';

		if(response['data'][theResponseIncre].comments)
		{postToPlace +=response['data'][theResponseIncre].comments['data'].length;}
		else
		{postToPlace +='0';}

		postToPlace +=' </div>';
		postToPlace +='<span id=\"theCommentSection'+theResponseIncre+'\"></span>';
		postToPlace +='<div id="fbYellowLine"><img src="RESOURCES/websiteFiles/Resouces/images/images/fbYellowLine.gif" width="205" height="2" /></div>';
		postToPlace +='</div>';
		postToPlace +='<div id="fbComments"><span id="commInputPlace'+theResponseIncre+'\"></span>';
		postToPlace +='<img src="RESOURCES/websiteFiles/Resouces/images/images/fbLikeHand.gif" width="23" height="16" align="absmiddle" />';
		postToPlace +='&nbsp; <span id="theLikable'+theResponseIncre+'" class="theCursorHand" onclick="getReadyToLike('+theResponseIncre+',\''+response['data'][theResponseIncre].id+'\')" style="color:#FC0;">Like</span> | ';
		postToPlace +='<span class="theCursorHand" onclick="setupCommentBox('+theResponseIncre+',\''+response['data'][theResponseIncre].id+'\')" style="color:#FC0;">Comment</span></div>';
				//document.getElementById('myTest').innerHTML=response['data'][theResponseIncre].link;
			
			}
		  
		if(!response['data'][theResponseIncre].message){continue;}
		

  		postToPlace +='<div id="fbprofilePic"><img src="RESOURCES/websiteFiles/Resouces/images/images/fbProfilePic.jpg" width="52" height="52" /></div>';
    	postToPlace +='<div id="fbPost">'+response['data'][theResponseIncre].message;
		postToPlace +='<span id="postAttach">';
		
		if(response['data'][theResponseIncre].picture){
		postToPlace +='<div><br /><a href="'+response['data'][theResponseIncre].link+'" target="_blank" ><img src="'+response['data'][theResponseIncre].picture+'" border="0" /></a></div>';
		}
		
		postToPlace +='</span>';
		var dateFirstPart=(response['data'][theResponseIncre].updated_time).substr(0,10);
		var dateSecPart = (response['data'][theResponseIncre].updated_time).substr(11,8);
		postToPlace +='<br /><br /><div id="createdAt">Date: '+dateFirstPart+'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Time: '+dateSecPart+'</div><br />';
		postToPlace +='<div id="fbWhiteLikes">';
		postToPlace +='Likes';
		
		if(response['data'][theResponseIncre].likes){postToPlace +=': '+response['data'][theResponseIncre].likes;}
		else
		{postToPlace +=':  0';}
		
		//postToPlace +=': ';likes
		postToPlace +=' <span class="fbYellow">&#8226; </span>'; 
		postToPlace +='<span class="theCursorHand" onclick="seeThisComment('+theResponseIncre+')"> Comments: </span>';
		
		if(response['data'][theResponseIncre].comments)
		{//
		try
  {
postToPlace +=response['data'][theResponseIncre].comments['data'].length;
  }
catch(err)
  {
postToPlace +='0';
  }

		//postToPlace +=response['data'][theResponseIncre].comments['data'].length;
		//postToPlace +='0';
		}
		else
		{postToPlace +='0';}
		
		postToPlace +=' </div>';
		postToPlace +='<span id=\"theCommentSection'+theResponseIncre+'\"></span>';
		postToPlace +='<div id="fbYellowLine"><img src="RESOURCES/websiteFiles/Resouces/images/images/fbYellowLine.gif" width="205" height="2" /></div>';
		postToPlace +='</div>';
		postToPlace +='<div id="fbComments"><span id="commInputPlace'+theResponseIncre+'\"></span>';
		postToPlace +='<img src="RESOURCES/websiteFiles/Resouces/images/images/fbLikeHand.gif" width="23" height="16" align="absmiddle" />';
		postToPlace +='&nbsp; <span id="theLikable'+theResponseIncre+'" class="theCursorHand" onclick="getReadyToLike('+theResponseIncre+',\''+response['data'][theResponseIncre].id+'\')" style="color:#FC0;">Like</span> | ';
		postToPlace +='<span class="theCursorHand" onclick="setupCommentBox('+theResponseIncre+',\''+response['data'][theResponseIncre].id+'\')" style="color:#FC0;">Comment</span></div>';
	
	//document.getElementById('myTest').innerHTML = response['data'][theResponseIncre].message;
		}
		
		document.getElementById('fbContent').innerHTML=postToPlace;
		
});





getTwitterNow();

			if(!MM_FlashCanPlay)
	{document.getElementById('theLatestGamTweets').innerHTML= 'sugar sugar';}
	
}


function  getReadyToLike(thePostNo, thePostId)
{

if(checkLoggedInStatus())
{	
	if(userId==null)
	{FB.api('/me', function(response){ userId=response.id; likeThisPost(thePostNo, thePostId); });}
	else
	{likeThisPost(thePostNo, thePostId); }
	
}
else 
{

FB.login(function(response) {			  
  if (response.session) {
	  userId=response.session.uid;
	  likeThisPost(thePostNo, thePostId);
  } else {
	  amILoggedIn=false;
  }
},{perms:'read_stream,publish_stream,user_photos'});
	
	
}

}





function seeThisComment(theCommentNo)
{
	
	var theId='theCommentSection'+theCommentNo;
	var theSubCommContent="";

	var noOfComments = theCommentsGain[theCommentNo].comments.count;
	if(noOfComments>0)
	{

	
	
	var postInfo = FB.Data.query('SELECT fromid, text FROM comment WHERE post_id="'+theCommentsGain[theCommentNo].post_id+'"');
	 postInfo.wait(function(amtOfResponses) {
							
							if(amtOfResponses.length>0)
							{
								for(var theResponses=0; theResponses<amtOfResponses.length; theResponses++)
								{
									
									
				var userInfo = FB.Data.query('SELECT first_name, last_name, pic_square FROM user WHERE uid="'+amtOfResponses[theResponses].fromid+'"');
	 userInfo.wait(function(userInfoResponses) 
							{
								
		theSubCommContent+='<div id="theCommentsDiv"><div id="theCommentsPicAndNameHOLDER">';
        theSubCommContent+='<div id="theCommentsPic"><img src="'+userInfoResponses[theResponses].pic_square+'" width="25" height="25" /></div>';
        theSubCommContent+='<div id="theCommentsName1">'+userInfoResponses[theResponses].first_name+'</div><div id="theCommentsName2">'+userInfoResponses[theResponses].first_name+'</div>';
       	theSubCommContent+=' </div>'+amtOfResponses[theResponses].text+'</div>';
							
							});
		
								}
		document.getElementById(theId).innerHTML=theSubCommContent;//theSubCommContent;
							}
							
 });
	 
	 

	}
			
}

function setupCommentBox(thePostNo,theComm_Id)
{
	//emptyCommentBox(theCommBoxPos)
	var theId= 'commInputPlace'+thePostNo;
	var theInputBox="";
	theInputBox+='<div align="center" id="commentInputHolder"><div id="commTADiv">';
    theInputBox+='<textarea id="theCommTxtArea'+thePostNo+'" onclick="emptyCommentBox(\'theCommTxtArea'+thePostNo+'\')" style="width:200px; height:23px; background-color:#212121; color:#CCC; border:1px; border-width:1px; border-style:solid; border-color:#333; font-family:Tahoma, Geneva, sans-serif; font-size:11px; overflow:auto; padding:0px; margin:0px;"></textarea>';
    theInputBox+='</div>';
    theInputBox+='<div id="commButtDiv"><input type="button" value="Send" style="width:50px; height:25px; background-color:#212121; color:#FC0; border:1px; border-width:1px; border-style:solid; border-color:#333; font-family:Tahoma, Geneva, sans-serif; font-size:11px;" onclick="commentOnThisPost(\''+thePostNo+'\',\''+theId+'\',\''+theComm_Id+'\')" /></div></div>';

	
	document.getElementById(theId).innerHTML=theInputBox;
}

function commentOnThisPost(thePos,theCommBox,theCommId)
{
	
	var theIdNeeded = 'theCommTxtArea'+thePos;
	var theComment = document.getElementById(theIdNeeded).value;

if(theComment!=""){//Check Value TextArea
if(checkLoggedInStatus())
{	
	if(userId==null)
	{FB.api('/me', function(response){ userId=response.id; commentOnThisPost_PartB(thePos,theCommBox,theCommId,theComment); });}
	else
	{ commentOnThisPost_PartB(thePos,theCommBox,theCommId,theComment); }
	
}
else 
{

FB.login(function(response) {			  
  if (response.session) {
	  userId=response.session.uid;
	  commentOnThisPost_PartB(thePos,theCommBox,theCommId,theComment);
  } else {
	  amILoggedIn=false;
  }
},{perms:'read_stream,publish_stream,user_photos'});
	
}
}//END Check Value TextArea
else
{
	document.getElementById(theIdNeeded).value="Please enter your comments";
}

}

function emptyCommentBox(theCommBoxPos)
{
	
	if(document.getElementById(theCommBoxPos).value=="Please Enter your comments")
	{ document.getElementById(theCommBoxPos).value=""; }
	
}

function commentOnThisPost_PartB(thePos,theCommBox,theCommId,theComment)
{
	
		FB.api(
  				{
    			method: 'stream.addComment',
				post_id:theCommId,
    			uid: userId,
				comment:theComment
 			 	},
 				function(res)
				{
					document.getElementById(theCommBox).innerHTML="Comment Successfully Posted<br /><br />";
				}
			);

}

function getTwitterNow()
{
			//MAKE THE AJAX XMLHTTPREQUEST OBJECT HERE			
			theAjaxHttp=getXMLHTTPRequest();
			
			var theURL = 'RESOURCES/websiteFiles/Resouces/phpScripts/getTwitt.php';
			theAjaxHttp.open("GET", theURL,true);
			theAjaxHttp.onreadystatechange=useHttpResponse;
			theAjaxHttp.send(null);
			delete theAjaxHttp;
}
			

			

function useHttpResponse(){

			if(theAjaxHttp.readyState==4){
				if(theAjaxHttp.status==200){
				
			var myJjjSONObj = theAjaxHttp.responseText;
			var latestTweets = JSON.parse( myJjjSONObj.substr(0,myJjjSONObj.indexOf(']')+1) );
			var theDate = latestTweets[0].created_at;
			
			var httpStartPoint = (latestTweets[0].text).indexOf('http://');
			var strAftHttp = (latestTweets[0].text).substr(httpStartPoint);
			var strAftFullHttp = strAftHttp.indexOf(' ');
			
			var firstPartTweet = (latestTweets[0].text).substr(0,httpStartPoint);
			var secPartTweet; var thirdPartTweet;
			if(strAftFullHttp>-1){secPartTweet=strAftHttp.substr(0,strAftFullHttp);}
			else{secPartTweet=strAftHttp;}
			if(strAftFullHttp>-1){thirdPartTweet=strAftHttp.substr(strAftFullHttp);}
			else{thirdPartTweet="";}
			
			if(secPartTweet!="")
			{secPartTweet="<a href=\""+secPartTweet+"\" class=\"timeAgo\" style=\"font-size: 16px; font-weight:bold; color:#ccc;\" target=\"_blank\">"+secPartTweet+"</a>";}
			
			document.getElementById('theLatestGamTweets').innerHTML=firstPartTweet+secPartTweet+thirdPartTweet;//latestTweets[0].text;
			document.getElementById('theCreatedAt').innerHTML=(theDate).substr(0,theDate.indexOf('+'));
			document.getElementById('theTwittLink').href=latestTweets[0].user.url;
			//(latestTweets[0].text).indexOf('http://');
			//JSON.stringify(theAjaxHttp.responseText);
					}
				}
				else{
					//document.getElementById('flashHolderCover').innerHTML="Verifying Advertisement Number";
					}
			}

function showFlashCover(theReq)
{
	//document.getElementById('flashHolderCoverCover').style.backgroundColor="#000000";
	var theItemToPlace="";
	keepMenuFlashCoverUp=true;
	clearTimeout(theCloseMenuTimerId);
	
	switch(theReq)
	{
		
		case 'whoWeAre':{
			//  
			theItemToPlace +='<div id="flashHolderCoverCover" onmouseover="showFlashCover(\'keepUp\')"  onmouseout="getReadyToHideFlashCover(\'whoWeAre\')" ></div>';
			theItemToPlace +='<div id="theCloseButt_MO" onmouseover="showFlashCover(\'keepUp\')"  onclick="getReadyToHideFlashCover(\'whoWeAre\')"  class="theCursorHand"><img src="RESOURCES/websiteFiles/Resouces/images/closeBtn.gif" border="0" /></div>';
			theItemToPlace +='<div id="contentHolderCont" onmouseover="showFlashCover(\'keepUp\')"><div class="contentHolder"><div class="contentTitle">';
    		theItemToPlace +='<p>We are people who specialise in <span id="yellow">social media marketing strategy</span> and who have the capability in-house to develop and implement the tools required. </p>';
    		theItemToPlace +='<p> We are recommended by Facebook and are members of their official Preferred Developer Consultant Programme.</p></div>';
			theItemToPlace +='<div class="addressText">39a Chobham Road<br />Woking<br />Surrey<br />GU21 6JD<br />United Kingdom </div>';
			theItemToPlace +='<div class="panoramHolder" id="right"><img src="RESOURCES/websiteFiles/Resouces/images/images/IMG_1490.jpg" width="346" height="115"/></div></div></div>';
			 document.getElementById('theWhoWeAreWord').style.color="#FC0";
			document.getElementById('flashHolderCover').innerHTML= theItemToPlace;
			document.getElementById('flashHolderCover').style.width='100%';
			document.getElementById('flashHolderCover').style.height='100%';
			fadeCoverOut();
			break;}
		case 'whatWeDo':{
			theItemToPlace +='<div id="flashHolderCoverCover" onmouseover="showFlashCover(\'keepUp\')"  onmouseout="getReadyToHideFlashCover(\'whatWeDo\')" ></div>';
			theItemToPlace +='<div id="theCloseButt_MO" onmouseover="showFlashCover(\'keepUp\')"  onclick="getReadyToHideFlashCover(\'whatWeDo\')"  class="theCursorHand"><img src="RESOURCES/websiteFiles/Resouces/images/closeBtn.gif" border="0" /></div>';
			theItemToPlace +='<div id="contentHolderCont" onmouseover="showFlashCover(\'keepUp\')"><div class="contentHolder"><div class="contentTitle">';
    		theItemToPlace +='<p>We develop campaign ideas for leveraging social media to drive brand engagement and awareness. <span id="yellow">We help brands use social networking</span> to reach their customers, establish two-way dialogue and maintain relationships.</p>';
			theItemToPlace +='<p>We develop rich-media widgets, games, Facebook applications and mashups that link together APIs from the various social networks such as Twitter, LinkedIn, Google, youTube, Facebook and more.</p>';
    		theItemToPlace +='<p><img src="RESOURCES/websiteFiles/Resouces/images/images/icons.jpg" width="447" height="49" /></p>';
  			theItemToPlace +='</div></div>';
			document.getElementById('theWhatWeDoWord').style.color="#FC0";
			document.getElementById('flashHolderCover').innerHTML= theItemToPlace; 
			document.getElementById('flashHolderCover').style.width='100%';
			document.getElementById('flashHolderCover').style.height='100%';
			fadeCoverOut();
			break;}
		
		case 'whoFor':{
			
			theItemToPlace +='<div id="flashHolderCoverCover" onmouseover="showFlashCover(\'keepUp\')"  onmouseout="getReadyToHideFlashCover(\'whoFor\')" class="theCursorHand" ></div>';
			theItemToPlace +='<div id="theCloseButt_MO" onmouseover="showFlashCover(\'keepUp\')"  onclick="getReadyToHideFlashCover(\'whoFor\')"  class="theCursorHand"><img src="RESOURCES/websiteFiles/Resouces/images/closeBtn.gif" border="0" /></div>';
			theItemToPlace +='<div id="contentHolderCont" class="contentHolder" onmouseover="showFlashCover(\'keepUp\')"><img src="RESOURCES/websiteFiles/Resouces/images/logos/images/clientLogo_01.gif" width="207" height="85" border="0" /><img src="RESOURCES/websiteFiles/Resouces/images/logos/images/clientLogo_02.gif" width="225" height="85" border="0" /><img src="RESOURCES/websiteFiles/Resouces/images/logos/images/clientLogo_03.gif" width="214" height="85" border="0" /><img src="RESOURCES/websiteFiles/Resouces/images/logos/images/clientLogo_04.gif" width="207" height="110" border="0" /> <img src="RESOURCES/websiteFiles/Resouces/images/logos/images/clientLogo_05.gif" width="225" height="110" /><img src="RESOURCES/websiteFiles/Resouces/images/logos/images/clientLogo_06.gif" width="214" height="110" /><img src="RESOURCES/websiteFiles/Resouces/images/logos/images/clientLogo_07.gif" width="207" height="100" /><img src="RESOURCES/websiteFiles/Resouces/images/logos/images/clientLogo_08.gif" width="225" height="100" /><img src="RESOURCES/websiteFiles/Resouces/images/logos/images/clientLogo_09.gif" width="214" height="100" /></div>';
			document.getElementById('theWhoForWord').style.color="#FC0";
			document.getElementById('flashHolderCover').innerHTML= theItemToPlace;
			document.getElementById('flashHolderCover').style.width='100%';
			document.getElementById('flashHolderCover').style.height='100%';
			fadeCoverOut();
			break;
		}
		
		case 'giveUsWork':{
			
			theItemToPlace +='<div id="flashHolderCoverCover" onmouseover="showFlashCover(\'keepUp\')"  onmouseout="getReadyToHideFlashCover(\'giveUsWork\')" ></div>';
			theItemToPlace +='<div id="theCloseButt_MO" onmouseover="showFlashCover(\'keepUp\')"  onclick="getReadyToHideFlashCover(\'giveUsWork\')"  class="theCursorHand"><img src="RESOURCES/websiteFiles/Resouces/images/closeBtn.gif" border="0" /></div>';
			theItemToPlace +='<div class="contentHolder"  onmouseover="showFlashCover(\'keepUp\')" ><div class="contentTitle">';
			theItemToPlace +='<p id="yellow">We want to hear from you</p>';
			theItemToPlace +='<p>An agency that has worked consistently with <br />the biggest brands, with people spawning from <br />London\'s NMA ranked agencies, means <br />you get all the ';
			theItemToPlace +='<span id="yellow">experience and expertise <br />at small agency rates</span>.<br /><br /> We know we can deliver, so get in touch now.</p><p>T: +44 14 8372 5552 <br />';
			theItemToPlace +='<span id="giveWorkLink"><a href="mailto:&#101;&#110;&#113;&#117;&#105;&#114;&#105;&#101;&#115;&#064;&#103;&#097;&#109;&#097;&#114;&#111;&#102;&#102;&#046;&#099;&#111;&#046;&#117;&#107;">';
			theItemToPlace +='&#101;&#110;&#113;&#117;&#105;&#114;&#105;&#101;&#115;&#064;&#103;&#097;&#109;&#097;&#114;&#111;&#102;&#102;&#046;&#099;&#111;&#046;&#117;&#107;</a></span></p></div></div>';
			theItemToPlace +='<div id="emFormHolder"  onmouseover="showFlashCover(\'keepUp\')"  onmouseout="getReadyToHideFlashCover(\'giveUsWork\')" style="background-color:#000; color:#CCC;"><div id="emFormHolderBody"  onmouseover="showFlashCover(\'keepUp\')"  onmouseout="getReadyToHideFlashCover(\'giveUsWork\')" class="formClass">';
			theItemToPlace +='<span class="MandatoryFormField">*</span> Name:<br /><input type="text" class="formBoxes" id="theContactName"/><br /><br /><span class="MandatoryFormField">*</span> Email Address:<br />';
			theItemToPlace +='<input type="text" class="formBoxes" id="theContactEmail" /><br /><br />Phone Number:<br /><input type="text" class="formBoxes" id="theContactPhoneNumber"/><br /><br /><span class="MandatoryFormField">*</span> Message:<br />';
			theItemToPlace +='<textarea style="overflow:auto;" class="formBoxes" id="theContactMessage" ></textarea><br /><br /><div align="right" id="conFormSub">';
			theItemToPlace +='<input type="submit" onclick="sendContactMessage()" value="Send message" class="formClass" style="background-color:#212121; color:#CCC; border-style:solid; border-width:thin; border-color:#333; color:#FC0;" />';
			theItemToPlace +='</div><span id="formErrors" style="color:#900;"></span></div></div>';
			
			document.getElementById('giveUsWorkWord').style.color="#FC0";
			document.getElementById('flashHolderCover').innerHTML= theItemToPlace;
			document.getElementById('flashHolderCover').style.width='100%';
			document.getElementById('flashHolderCover').style.height='100%';
			fadeCoverOut();
			break;}
		case 'whatLooks':{
			theItemToPlace +='<div id="flashHolderCoverCover" onmouseover="showFlashCover(\'keepUp\')"  onmouseout="getReadyToHideFlashCover(\'whatLooks\')" onclick="showPortfolio()" class="theCursorHand"></div>';
			theItemToPlace +='<div id="theCloseButt_MO" onmouseover="showFlashCover(\'keepUp\')"  onclick="getReadyToHideFlashCover(\'whatLooks\')"  class="theCursorHand"><img src="RESOURCES/websiteFiles/Resouces/images/closeBtn.gif" border="0" /></div>';
			theItemToPlace +='<div class="contentHolder" onmouseover="showFlashCover(\'keepUp\')" onclick="showPortfolio()" class="theCursorHand"><img src="RESOURCES/websiteFiles/Resouces/images/images/potfolio.jpg" width="650" height="300" border="0" class="theCursorHand" /></div>';
			
			document.getElementById('theWhatLooksWord').style.color="#FC0";
			document.getElementById('flashHolderCover').innerHTML= theItemToPlace;
			document.getElementById('flashHolderCover').style.width='100%';
			document.getElementById('flashHolderCover').style.height='100%';
			fadeCoverOut();
			break;}
		default:{ break;}
		
	}

}

function validateContactForm()
{
	var formValidated=true;
	var correctEmail = true;
	var theConName = document.getElementById('theContactName').value;
	var theCPhnNum = document.getElementById('theContactPhoneNumber').value;
	var theConMess = document.getElementById('theContactMessage').value;
	
	if(theConName==""){formValidated=false;}
	if(theConMess==""){formValidated=false;}
	
		if(document.getElementById('theContactEmail').value==""){formValidated=false;}
		else
		{
			if((document.getElementById('theContactEmail').value.indexOf('@')+1)<1){correctEmail=false;}	
			if((document.getElementById('theContactEmail').value.indexOf('.')+1)<1){correctEmail=false;}	
		}
		
		if(formValidated){ document.getElementById('formErrors').innerHTML="";}else{ document.getElementById('formErrors').innerHTML="Please fill all required fields";}
		
		if(!correctEmail){document.getElementById('formErrors').innerHTML="Please enter a valid email address"; formValidated=false;}
	
	if(formValidated){return true; }else{return false;}
	
}


function sendContactMessage()
{
	if(validateContactForm())
	{
		var theConName = document.getElementById('theContactName').value; 
		document.getElementById('theContactName').value="";
		var theCPhnNum = document.getElementById('theContactPhoneNumber').value; 
		document.getElementById('theContactPhoneNumber').value="";
		var theConEmail = document.getElementById('theContactEmail').value;
		document.getElementById('theContactEmail').value="";
		var theConMess = document.getElementById('theContactMessage').value;
		document.getElementById('theContactMessage').value="";
		if(userId!=null){theUserIdToSend= userId;}else{theUserIdToSend="not available";}
		
		
			conAjaxHttp=getXMLHTTPRequest();
			var theURL = 'RESOURCES/websiteFiles/Resouces/phpScripts/sendContactEmail.php?theMess='+theConMess+'&theConName='+theConName+'&theCPhnNum='+theCPhnNum+'&theConEmail='+theConEmail+'&userId='+theUserIdToSend;
			conAjaxHttp.open("GET", theURL,true);
			 conAjaxHttp.onreadystatechange=reportOnMessageSend;
			conAjaxHttp.send(null);
			
	}
}

function reportOnMessageSend()
{

			if(conAjaxHttp.readyState==4){
				if(conAjaxHttp.status==200){
				document.getElementById('formErrors').innerHTML="Thank you! We will get back to you very quickly";
					}
				}
				else{
					document.getElementById('formErrors').innerHTML="Sending message ...";
					}
}


function fadeCoverOut()
{
	clearInterval(fadeInterval); fadeValue=10;
	document.getElementById('flashHolderCoverCover').style.opacity = 10/10;
	document.getElementById('flashHolderCoverCover').style.filter = 'alpha(opacity=' + 10*10 + ')';
	fadeInterval=setInterval("fadeCoverOutNOW();",80);
}

function fadeCoverOutNOW()
{
	document.getElementById('flashHolderCoverCover').style.opacity = fadeValue/10;
	document.getElementById('flashHolderCoverCover').style.filter = 'alpha(opacity=' + fadeValue*10 + ')';
	fadeValue--;
	if(fadeValue<0)
	{
		clearInterval(fadeInterval); fadeValue=10;
		document.getElementById('flashHolderCoverCover').style.width='0%';
		document.getElementById('flashHolderCoverCover').style.height='0%';
	}
	
}

function getReadyToHideFlashCover(theReq)
{
	switch(theReq)
	{
		case 'whoWeAre':{document.getElementById('theWhoWeAreWord').style.color="#FFFFFF";  break;}
		case 'whatWeDo':{document.getElementById('theWhatWeDoWord').style.color="#FFFFFF";  break;}
		case 'giveUsWork':{document.getElementById('giveUsWorkWord').style.color="#FFFFFF";  break;}
		case 'whoFor':{document.getElementById('theWhoForWord').style.color="#FFFFFF";  break;}
		case 'whatLooks':{document.getElementById('theWhatLooksWord').style.color="#FFFFFF";  break;}
		default :{break;}
	}
	keepMenuFlashCoverUp=false;
	theCloseMenuTimerId = setTimeout("hideFlashCover();",50);
}

function changeBackMenu(theReq)
{
	switch(theReq)
	{
		case 'whoWeAre':{document.getElementById('theWhoWeAreWord').style.color="#FFFFFF";  break;}
		case 'whatWeDo':{document.getElementById('theWhatWeDoWord').style.color="#FFFFFF";  break;}
		case 'giveUsWork':{document.getElementById('giveUsWorkWord').style.color="#FFFFFF";  break;}
		case 'whoFor':{document.getElementById('theWhoForWord').style.color="#FFFFFF";  break;}
		case 'whatLooks':{document.getElementById('theWhatLooksWord').style.color="#FFFFFF";  break;}
		default :{break;}
	}
}

function hideFlashCover()
{
	clearTimeout(theCloseMenuTimerId);
	if(!keepMenuFlashCoverUp)
	{
		document.getElementById('flashHolderCover').innerHTML= "";
		document.getElementById('flashHolderCover').style.width='0%';
		document.getElementById('flashHolderCover').style.height='0%';
	}
}


function whatClientsThinkScrollX(eyeD,scrollAMT,dir)
{
whatClientsThinkTimer=setInterval(function() { if(dir == 'up'){document.getElementById(eyeD).scrollTop += scrollAMT;}else{document.getElementById(eyeD).scrollTop -= scrollAMT;}},1);
}

var rr=0;
function fbCommentsScrollX(eyeD,scrollAMT,dir)
{
fbCommentsScrollTimer=setInterval(function() { if(dir == 'up'){document.getElementById(eyeD).scrollTop += scrollAMT;}else{document.getElementById(eyeD).scrollTop -= scrollAMT;}},1);
}



function showPortfolio()
{
document.getElementById('fullCoverContainer').style.height='100%';
document.getElementById('fullCoverContainer').style.width='100%';

var fullCoverContainerContents="";
fullCoverContainerContents+='<div id="fullCover" style="background-color:#FFFFFF;" align="center"></div>';
fullCoverContainerContents+='<table width="100%" height="100%" border="0" id="thePF_Table">';
fullCoverContainerContents+='<tr><td align="center"><div id="potfolioPlace" style="color:#FFF;">';
fullCoverContainerContents+='<div id="thePlaceForPF_SWF"></div>';
//fullCoverContainerContents+='<div style="color:#ffcc02; width:1030px; font-size:18px; font-weight:bolder;" align="right" id="theCloseSWFplace" onclick="closeSWFArea()">thttehethtehhtethe</div>';
fullCoverContainerContents+='<div id="theCloseButtPF" class="theCursorHand" onclick="closeSWFArea()">X</div>';
fullCoverContainerContents+='</div>';
//fullCoverContainerContents+='<div id="theCloseButtPF" style="position:absolute; color:#000000; background-color:#CCCCCC; width:200px; height:200px; top:250px; left:1050px;">Close</div>';
fullCoverContainerContents+='</td></tr></table>';
//<div id="potfolioPlace" style="color:#FFF;"></div>
document.getElementById('fullCoverContainer').innerHTML=fullCoverContainerContents;
fadeinPortfBckG();
}



function closeSWFArea()
{
	document.getElementById('fullCoverContainer').innerHTML="";
	document.getElementById('fullCoverContainer').style.width='0%';
	document.getElementById('fullCoverContainer').style.height='0%';
}


function fadeinPortfBckG()
{
	
	var pf_Location="RESOURCES/websiteFiles/Resouces/swfs/portfolio/GDPortfolioQ.swf";

	var attri = {  id: "bigFl",  name: "bigFl", quality: "high"};
		var theParams = {}; /*theParams.allowscriptaccess = "always";*/ //theParams.wmode = "transparent";
	swfobject.embedSWF(pf_Location, "thePlaceForPF_SWF", "1030", "430", "9", false, {}, theParams, attri);
	
	
	
	clearInterval(pF_fadeInterval); pFoliofadeValue=0;
	document.getElementById('fullCover').style.opacity = 0/10;
	document.getElementById('fullCover').style.filter = 'alpha(opacity=' + 0*10 + ')';
	pF_fadeInterval=setInterval("fadeinPortfBckGNOW();",100);
}


function fadeinPortfBckGNOW()
{
	document.getElementById('fullCover').style.opacity = pFoliofadeValue/10;
	document.getElementById('fullCover').style.filter = 'alpha(opacity=' + pFoliofadeValue*10 + ')';
	//document.getElementById('bigFl').style.height=pf_tableHeight+'px';
	//document.getElementById('potfolioPlace').style.height=pf_tableHeight+'px';
	//document.getElementById('bigFl').style.height=pf_tableHeight+'px';
	
	pFoliofadeValue++;
	if(pFoliofadeValue>7)
	{
		clearInterval(pF_fadeInterval); pFoliofadeValue=8;
		document.getElementById('bigFl').style.height='430px';
		document.getElementById('bigFl').style.width='1030px';
		
		//loadPF_SWF();
		var loadSWFTimer = setTimeout("loadPF_SWF();",900);

	}
	if(pf_tableHeight>400){pf_tableHeight=430}else{pf_tableHeight+=60;}
	//if(pf_tableWidth>1000){pf_tableWidth+=1030;}else{pf_tableWidth+=150;}
	
}

function loadPF_SWF()
{
	document.getElementById('thePlaceForPF_SWF').style.opacity = 3/10;
	document.getElementById('thePlaceForPF_SWF').style.filter = 'alpha(opacity=' + 3*10 + ')';
}


function checkLoggedInStatus()
{
var theLoggedInStatus;

	FB.getLoginStatus(function(response) {
  if (response.session) {
        theLoggedInStatus = true;
  } else {
        theLoggedInStatus = false;
  }
});
	
	return theLoggedInStatus;
}



function logInNow(thePostNo, thePostId)
{
		FB.login(function(response) {
						  
  if (response.session) {
	  
	  likeThisPost(thePostNo, thePostId);
	  
  } else {
    return false;
  }

},{perms:'read_stream,publish_stream,user_photos'});
		
}




function likeThisPost(thePostNo, thePostId)
{

FB.api(
  {
    method: 'fql.query',
    query: 'SELECT likes FROM stream WHERE  post_id = \''+thePostId+'\''
  },
  function(response) 
  {
	  if(!response[0]['likes']['user_likes'])
	  	{
		  FB.api(		{
			method: 'Stream.addLike',
			uid: userId,
			post_id: thePostId,
			},
			function(re) 
			{
				document.getElementById('theLikable'+thePostNo).innerHTML="Unlike";
			}
			);
		}
		
		
	  if(response[0]['likes']['user_likes'])
	  	{
		  FB.api(		{
			method: 'Stream.removeLike',
			uid: userId,
			post_id: thePostId,
			},
			function(res) 
			{
				document.getElementById('theLikable'+thePostNo).innerHTML="Like";
			}
			);
		}
	  
	  
	  
  }
);


}

function imgDownload(thePicSent)
{

var theAlbumName = thePicSent.substring(0,2);
	var thePicToUpload = 'http://www.gamaroff.co.uk/game/'+theAlbumName+'/'+thePicSent+'.jpg';
	//var thePicToUpload = 'http://www.gamaroff.co.uk/game/'+theAlbumName+'/'+thePicSent+'.jpg';

var theDownload = window.open('download.php?file='+thePicToUpload+'&theFileName='+thePicSent, '_blank');

//document.getElementById('myTest').innerHTML=thePicToUpload;
}

function fB_albumPost(thePicSent,ptW,ptA)
{




	var theAlbumName = thePicSent.substring(0,2);
	var thePicToUpload = 'game/'+theAlbumName+'/'+thePicSent+'.jpg';
	
	
	
	
if(checkLoggedInStatus())
{	
	if(userId==null){FB.api('/me', function(response){ 
											userId=response.id; 
	if(ptA=="1"){UploadPictureToFaceBook(thePicToUpload);}
	if(ptW=="1"){postMessAndPicToWall(userId,thePicToUpload);}	
	saveUserInfo(thePicToUpload);									
											});
											
											}
	else
	{
	if(ptA=="1"){UploadPictureToFaceBook(thePicToUpload);}
	if(ptW=="1"){postMessAndPicToWall(userId,thePicToUpload);}
	saveUserInfo(thePicToUpload);
	}
}
else 
{

FB.login(function(response) {			  
  if (response.session) {
	  userId=response.session.uid;
	  //Post To Wall
	  if(ptA=="1"){UploadPictureToFaceBook(thePicToUpload);}
	  if(ptW=="1"){postMessAndPicToWall(userId,thePicToUpload);}
	  saveUserInfo(thePicToUpload);
	  
  } else {
	  amILoggedIn=false;
  }
},{perms:'read_stream,publish_stream,user_photos'});
	
	
}



}

function saveUserInfo(thePicToStore)
{
			var thePicToUp = "http://www.gamaroff.co.uk/"+thePicToStore;
			theAjaxHttp=getXMLHTTPRequest();
			var theURL = 'RESOURCES/websiteFiles/Resouces/phpScripts/saveInfo.php?userId='+userId+'&thePicToUp='+thePicToUp;
			//document.getElementById('myTest').innerHTML=theURL;
			theAjaxHttp.open("GET", theURL,false);
			 //theAjaxHttp.onreadystatechange=useHttpResponse;
			theAjaxHttp.send(null);
			//document.getElementById('theLatestGamTweets').innerHTML=theAjaxHttp.responseText;
			addlikeToSelectedPost();
}

function addlikeToSelectedPost(theUid)
{
	//stream_addLike
		FB.api(
  				{
    			method: 'Stream.addLike',
    			uid: theUid,
				post_id:'31574415784_126302784055899'
 			 	},
 				function(res)
				{
					document.getElementById('theLogoGame').postComplete();
				}
			);
}

function postMessAndPicToWall(theUid,thePicToUpL)
{

	var theImage= 'http://www.gamaroff.co.uk/'+thePicToUpL;
	var att = {
	'name': 'Gamaroff Digital',
	'href': 'http://www.gamaroff.co.uk/',
	'description': 'This is my Gamaroff Alien creation',
	'media': [{ 'type': 'image', 'src': theImage, 'href': 'http://www.gamaroff.co.uk/'}]
	};

	FB.api(
  				{
    			method: 'Stream.publish',
    			uid: theUid,
				message:'I\'ve just created my own GD alien on Gamaroff Digital\'s site. Come make your own now',
				target_id:theUid,
				attachment:att
 			 	},
 				function(res)
				{
					document.getElementById('theLogoGame').postComplete();
					//document.getElementById('theLatestGamTweets').innerHTML='http://www.gamaroff.co.uk/'+thePicToUpL;//JSON.stringify(res);
					//document.getElementById('theLatestGamTweets').innerHTML= theImage;
				}
			);

}
		
		
function UploadPictureToFaceBook(thePicToUpload)
{	

var GD_albm = 'none';

//FB.api('me/albums', function(response){ document.getElementById('myTest').innerHTML=response.data.length; });


FB.api('me/albums', function(response) {//START OF GET PHOTO FUNC

	for(var albNo=0; albNo<response.data.length; albNo++)
	{ 
	if(response.data[albNo].name=='Gamaroff Digital')
	{
		//GD_albm = response.data[albNo].link;  break;}//GD_albm = response[albNo].aid; break;}
		
		var theLink = response.data[albNo].link;
	var indexAfterAid = (theLink.indexOf('aid=',0))+4;
	theLink=theLink.substring(indexAfterAid);
	var indexAfter_id =theLink.indexOf('&id=',0);
	GD_albm=theLink.substring(0,indexAfter_id);
	
		break;
	}
	
	}
	

	
	if(GD_albm == 'none')
	{//START IF GD_albm ==NONE
	
	
		document.getElementById('theLogoGame').postComplete();
		
				FB.api(
  				{
    			method: 'photos.createAlbum',
    			uid: userId,
				description:'I\'ve just created my own GD alien on Gamaroff Digital\'s site. Come make your own now',
				name:'Gamaroff Digital'
 			 	},
 				function(res)
				{
					GD_albm=res.aid;
					
				});
				
	}//END IF GD_albm ==NONE
					
					////////////////////////////////Uploading Pic/////////////////////////////////////
			theAjaxHttp=getXMLHTTPRequest();
			var theURL = 'uploader.php?uid='+userId+'&aid='+GD_albm+'&thePicToUpload='+thePicToUpload;
			//document.getElementById('myTest').innerHTML=theURL;
			theAjaxHttp.open("GET", theURL,false);
			 //theAjaxHttp.onreadystatechange=useHttpResponse;
			theAjaxHttp.send(null);
			
			if((JSON.parse(theAjaxHttp.responseText)).pid)
			{
				//document.getElementById('theLogoGame').postComplete(); 
				//document.getElementById('theLatestGamTweets').innerHTML=(JSON.parse(theAjaxHttp.responseText)).pid;//"Photo Uploaded Successfully";
				document.getElementById('theLogoGame').postComplete();
			}
			
			////////////////////////////////Uploading Pic DONE/////////////////////////////////////

		
		
	


	
  					}//END OF GET PHOTO FUNC
);

}