﻿var flashversion = "9.0.115";

if(typeof(swfobject)=='object' && swfobject.hasFlashPlayerVersion(flashversion)){
	var head = document.getElementsByTagName('head');
	var flashstyle = document.createElement('style');
	var css = '#flashcontent h1, #flashcontent p {display: none}';
	flashstyle.setAttribute('type','text/css');
	if(head[0]){
		if(flashstyle.styleSheet){
			flashstyle.styleSheet.cssText = css;
		}else{
			flashstyle.appendChild(document.createTextNode(css));
		}
		head[0].appendChild(flashstyle);
	}
}

function dearJohnSwf() {
	var flashvars = {
	};
									
	var params = {
		allowscriptaccess:"always",
		allowfullscreen:"true",
		base:"http://flash.sonypictures.com/intl/jp/movies/thekaratekid/media/",
		wmode:"opaque"
	};
				
	var attributes = {
	};
										
	swfobject.embedSWF("http://flash.sonypictures.com/intl/jp/movies/thekaratekid/media/loader.swf", "flashcontent", "100%", "634", "9.0.115", "", flashvars, params, attributes);
}


/*
var share = {
	// required
	url: null,
	title: null,
	tracking: false,
	
	// optional
	description: null,
	property: null,
	unique_tracking_id: '_button',
	
	// specific
	tweet: null,
	
	// custom settings
	delicious: {},
	digg: {},
	facebook: {},
	myspace: {},
	reddit: {},
	stumbleupon: {},
	twitter: {},
	
	send: function (site)
	{

		switch (site) {
			case 'delicious':
				// check for custom settings
				var url = typeof this.delicious.url != 'undefined' ? this.delicious.url : this.url;
				var title = typeof this.delicious.title != 'undefined' ? this.delicious.title : this.title;
				var description = typeof this.delicious.description != 'undefined' ? this.delicious.description : this.description;
				var tracking_link = 'http://delicious.com';

				if (url && title) {
					var link = 'http://delicious.com/save?url=' + escape(url) + '&title=' + escape(title) + '&notes=' + escape(description);
				}
				break;
			case 'digg':
				// check for custom settings
				var url = typeof this.digg.url != 'undefined' ? this.digg.url : this.url;
				var title = typeof this.digg.title != 'undefined' ? this.digg.title : this.title;
				var description = typeof this.digg.description != 'undefined' ? this.digg.description : this.description;
				var tracking_link = 'http://digg.com';

				if (url && title) {
					var link = 'http://digg.com/submit?phase=2&partner=[partner]&url=' + escape(url) + '&title=' + escape(title);
				}
				break;
			case 'facebook':
				// check for custom settings
				var url = typeof this.facebook.url != 'undefined' ? this.facebook.url : this.url;
				var title = typeof this.facebook.title != 'undefined' ? this.facebook.title : this.title;
				var tracking_link = 'http://www.facebook.com/sharer.php';
				
				if (url) {
					var link = 'http://www.facebook.com/sharer.php?u=' + escape(url) + '&t=' + escape(title);
				}
				break;
			case 'myspace':
				// check for custom settings
				var url = typeof this.myspace.url != 'undefined' ? this.myspace.url : this.url;
				var title = typeof this.myspace.title != 'undefined' ? this.myspace.title : this.title;
				var description = typeof this.myspace.description != 'undefined' ? this.myspace.description : this.description;
				var tracking_link = 'http://www.myspace.com';
				
				if (url && title) {
					var link = 'http://www.myspace.com/Modules/PostTo/Pages/?u=' + escape(url) + '&t=' + escape(title) + '&c=' + escape(description);
				}
				break;
			case 'reddit':
				// check for custom settings
				var url = typeof this.reddit.url != 'undefined' ? this.reddit.url : this.url;
				var title = typeof this.reddit.title != 'undefined' ? this.reddit.title : this.title;
				var tracking_link = 'http://www.reddit.com';
				
				if (url && title) {
					var link = 'http://www.reddit.com/r/reddit.com/submit?url=' + escape(url) + '&title=' + escape(title);
				}
				break;
			case 'stumbleupon':
				// check for custom settings
				var url = typeof this.stumbleupon.url != 'undefined' ? this.stumbleupon.url : this.url;
				var title = typeof this.stumbleupon.title != 'undefined' ? this.stumbleupon.title : this.title;
				var tracking_link = 'http://www.stumbleupon.com';
				
				if (url && title) {
					var link = 'http://www.stumbleupon.com/submit?url=' + escape(url) + '&title=' + escape(title);
				}
				break;
			case 'twitter':
				var tracking_link = 'http://twitter.com';
				if (this.tweet) {
					var link = 'http://twitter.com/home?status=' + escape(this.tweet);
				}
				break;
		}


		if (this.tracking && typeof s == "object") {
			var property = this.property?this.property+'_':'';//s.prop4.substring(s.prop4.lastIndexOf(':') + 1);
			sCode.trackOutboundClick(tracking_link, 'share' + site + this.unique_tracking_id);
		}

		if (link) 
			if(!window.open(link))
				alert('Please disable your popup blocker');
	},
	setUrl: function(url){
		this.url = url;
	},
	setTweet: function(str){
		this.tweet = str;
	},
	setTitle: function(str){
		this.title = str;
	},
	setDescription: function(str){
		this.description = str;
	}
	
};
*/

share.url = "http://bestkid.jp/";
share.title = "映画「ベスト・キッド」8月14日（土）より公開 | オフィシャルサイト";
share.facebook.title = '映画「ベスト・キッド」8月14日（土）より公開 | オフィシャルサイト';
share.facebook.description = "In Columbia Pictures' The Karate Kid, 12-year-old Dre Parker (Jaden Smith) could've been the most popular kid in Detroit, but his mother's latest career move has taken them to China.  Dre immediately falls for his classmate Mei Ying, but cultural differences make such a friendship impossible. Even worse, Dre's feelings make an enemy of the class bully, and kung fu prodigy, Cheng.  In the land of kung fu, Dre knows only a little karate, and Cheng puts 'the karate kid' on the floor with ease.  With no friends in a strange land, Dre has nowhere to turn but maintenance man Mr. Han (Jackie Chan), who is secretly a kung fu master.  As Han teaches Dre that kung fu is not about punches and skill, but maturity and calm, Dre realizes that facing down the bullies will be the adventure of a lifetime."
share.description = "In Columbia Pictures' The Karate Kid, 12-year-old Dre Parker (Jaden Smith) could've been the most popular kid in Detroit, but his mother's latest career move has taken them to China.  Dre immediately falls for his classmate Mei Yin,  but cultural differences make such a friendship impossible. Even worse, Dre's feelings make an enemy of the class bully, and kung fu prodigy, Cheng.   With no friends in a strange land, Dre has nowhere to turn but maintenance man Mr. Han (Jackie Chan), who is secretly a kung fu master.  As Han teaches Dre that kung fu is not about punches and skill, but maturity and calm, Dre realizes that facing down the bullies will be the adventure of a lifetime.";
share.tweet = "映画『ベスト・キッド』 http://bestkid.jp│8／14(土)より新宿ピカデリー他全国公開！│あの大ヒット作待望のリメイク！ジャッキー・チェンと、ウィル・スミスの実子であり、『幸せのちから』 で日本中の涙を誘ったジェイデン・スミスが新たに師弟タッグを組んだ感動ドラマ。";
share.digg.description = "THE KARATE KID, starring Jaden Smith and Jackie Chan, is a story about a bullied boy who learns self-defense and much more under the tutelage of an unlikely kung-fu master.";
share.myspace.title = '映画「ベスト・キッド」8月14日（土）より公開 | オフィシャルサイト';
share.myspace.description = '';

// 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() {
				document.getElementById('flashcontent').shareActive();
				share.send(this.getAttribute('rel'));						
				return false;
			}
		} else if (link.getAttribute('rel') == 'facebookfan') {	
			link.onclick= function() {
				document.getElementById('flashcontent').shareActive();
			}
		}
	}
}

addLoadEvent(dearJohnSwf);
//addLoadEvent(shareThis);
