// Share Info
share.tracking = true;
share.url = "http://www.thisisitmovieondvd.com/";
share.title = "Michael Jackson's THIS IS IT";
share.description = "A la venta el 23 de febrero de 2010 en Blu-ray y DVD";
share.tweet = "Michael Jackson's THIS IS IT - A la venta el 23 de febrero de 2010 en Blu-ray y DVD - http://www.sonypictures.es/sites/thisisit/";
share.delicious.description = "Michael Jackson's THIS IS IT - A la venta el 23 de febrero de 2010 en Blu-ray y DVD";

// Social bookmarking function
function shareThis() {

	var links = document.getElementById('share').getElementsByTagName('a');
	for (i=0; i<links.length; i++) {
		var link = links[i];
		if( (link.getAttribute('rel') == 'facebook') || (link.getAttribute('rel') == 'myspace') || (link.getAttribute('rel') == 'twitter') || (link.getAttribute('rel') == 'delicious') || (link.getAttribute('rel') == 'digg') || (link.getAttribute('rel') == 'stumbleupon'))
		{
			link.onclick= function() {
				share.send(this.getAttribute('rel'));		
				return false;
			}
		}
	}

}

var flashversion = "9.0.115";

if(typeof(swfobject)=='object' && swfobject.hasFlashPlayerVersion(flashversion)){
	
	var head = document.getElementsByTagName('head');
	var flashstyle = document.createElement('style');
	var css = '#mjcontainer p {display: none}';
	flashstyle.setAttribute('type','text/css');	
	if(head[0]){
		if(flashstyle.styleSheet){//cause you can't put text in the webstandards way in ie
			flashstyle.styleSheet.cssText = css;
		}else{
			flashstyle.appendChild(document.createTextNode(css));
		}
		head[0].appendChild(flashstyle);
	}

}

function mjSwfEmbed() {
	var flashvars = {};
	var params = {
		wmode: 'transparent',
		allowscriptacces: 'always',
		base: 'media/',
		allowfullscreen: 'true'
	};
	var attributes = {};
	swfobject.embedSWF("media/cms.swf", "mjcontainer", "1000", "934", "9.0.115","", flashvars, params, attributes);
}

var sizedPopUp = function (url,name,windowWidth,windowHeight){
	myleft=(screen.width)?(screen.width-windowWidth)/2:100;
	mytop=(screen.height)?(screen.height-windowHeight)/2:100;
	properties = "width="+windowWidth+",height="+windowHeight+",scrollbars=yes, top="+mytop+",left="+myleft;
	var windowRef = window.open(url,name,properties)
	if (windowRef.location.href == url) windowRef.focus();
}

var facebookShare = function (shareID) {
	var description;
			   
	var url = 'http://www.thisisitmovieondvd.com/';
	var image_src = 'http://www.thisisitmovieondvd.com/share/images/poster.jpg';
	var title = 'Michael Jackson\'s This Is it';
			   
	switch (shareID) {
		case 0:
			description = 'No puedo esperar a ver This Is It http://www.sonypictures.es/sites/thisisit/  A la venta el 23 de febrero en Blu-ray y DVD.';
			break;
		case 1:
			description = 'Voy a comprar This Is It http://www.sonypictures.es/sites/thisisit/  A la venta el 23 de febrero en Blu-ray y DVD.';
			break;
		case 2:
			description = 'He visto el trailer de This Is It http://www.sonypictures.es/sites/thisisit/ A la venta el 23 de febrero en Blu-ray y DVD.';
			break;
		}
			   
		var sharePath = 'http://www.thisisitmovieondvd.com/share';
		var shareURL = encodeURIComponent(sharePath + '?' + 'url='+url+'&title=' + title + '&description=' + description + '&image_src=' + image_src);
		
		//sizedPopUp('http://www.facebook.com/sharer.php?u=' + shareURL + '&t=' + escape(title), 'share', 626, 436);
			   window.open('http://www.facebook.com/sharer.php?u=' + shareURL + '&t=' + escape(title), '_blank');
		};


//addLoadEvent(shareThis);
addLoadEvent(mjSwfEmbed);


