$(document).ready(function () {
path="http://www.playgamesnow.net/bookmark/";
title=encodeURIComponent(document.title);
url=encodeURIComponent(document.location);
desc=encodeURIComponent(document.getElementsByTagName("meta").item(1).content);
$("#bookmark").html('<a class="social_img" href="http://www.myspace.com/Modules/PostTo/Pages/?t='+title+'&c='+desc+'&u='+url+'&l=2" title="Add to MySpace"><img src="'+path+'myspace.gif" alt="MySpace"/></a> <a class="social_img" href="http://www.facebook.com/share.php?u='+url+'" title="Add to Facebook"><img src="'+path+'facebook.png" alt="Facebook"/></a> <a class="social_img" href="http://del.icio.us/post?url='+url+'&title='+title+'" title="Add to Del.icio.us"><img src="'+path+'delicious.png" alt="Del.icio.us"/></a> <a class="social_img" href="http://www.stumbleupon.com/submit?url='+url+'&title='+title+'" title="Stumble it !"><img src="'+path+'stumble.png" alt="Stumble it !"/></a> <a class="social_img" href="http://www.mixx.com/submit?page_url='+url+'" title="Add to Mixx"><img src="'+path+'mixx.png" alt="Mixx"/></a> <a class="social_img" href="http://digg.com/submit?url='+url+'&title='+title+'&bodytext='+desc+'&topic=playable_web_games" title="Digg it !"><img src="'+path+'digg.png" alt="Digg"/></a> <a class="social_img" id="mailit" href="'+path+'sendform.php?url='+url+'&title='+title+'" title="Send Email"><img src="'+path+'email.png" alt="Email"/></a>');
$(".social_img").bind("mouseenter", function(e) { status= $(this).attr("title"); $("#dowhat").html(status); });
$(".social_img").bind("mouseleave", function(e) {  $("#dowhat").html(""); });
$('.social_img').bind("click",function(e){
					e.preventDefault();
					var address 	= this;
                    var width		= 0;	
					if ($(this).attr("id")=="mailit") {
						width=380;
					var	height=320;
						pos = $("#bookmark").offset(); 
						
					var	left= pos.left;
				 var  top=pos.top +20;
					}
					else {
						  var  top=($( document).scrollTop()) + 20;
					var left		= 50;
					
					if(jQuery.browser.msie){
						width = document.body.clientWidth;
						height= document.documentElement.clientHeight;
					}else{
						width	= window.innerWidth;
						height	= window.innerHeight;
					}
					}
			        
			var wind 		= document.createElement("div");
			
            
			        var cssObj;	
					if(jQuery.browser.msie){
						 cssObj = {
							top:top,
							width:''+(width-100)+'px',
							height:''+(height-50)+'px',
							position:'absolute',
							left: left + 'px',
							border: '1px solid #ccc',	
							visibility:'visible'
							
													
			
						 }
			
				}else{
						 cssObj = {
							top:top,
							width:''+(width-100)+'px',
							position:'absolute',
							left: left + 'px',
							background:'#FFF',
							height:''+(height-50)+'px'
						
						
						 }
					}
						
					$(wind).css(cssObj);
					
					
					var closeX = document.createElement('img');
					$(closeX).attr({ src:path+"close.gif"});
					$(closeX).css({position:'relative', top:'0px', right:'0', float:'right'});
					$(closeX).click(function(){
						$(wind).remove();											
					});
					
					$(wind).prepend(closeX);
					$('body').append(wind);
					
					var cssObj2 = {
        				width:''+(width-100)+'px',
						height:''+(height-50)+'px',
						border: 'none',
						position:'absolute',
						overflow:'auto',
						display:'block'
     				 }
					
					var c	 = document.createElement('iframe');		
					$(c).attr("src",this);
					$(c).css(cssObj2);
					$(wind).prepend(c);
					
	       });			
							});