﻿
function CheckJs(){
	// from defalut.html to each sl page
	this.linkObject = {
				"sharemoment":		"http://go.microsoft.com/?linkid=9667087",
				"moremedia":		"http://go.microsoft.com/?linkid=9667089",
				"sharingmemories":	"http://go.microsoft.com/?linkid=9667088",
				"creatingvideo":	"http://go.microsoft.com/?linkid=9667090",
				"deliverfeeling":	"http://go.microsoft.com/?linkid=9667086",
				"niko":	"http://go.microsoft.com/?linkid=9667366",
				"riho":	"http://go.microsoft.com/?linkid=9667369",
				"leorena":	"http://go.microsoft.com/?linkid=9667372"
			}

	// check whether this page is "_sl default"?
	if( ( location.href.indexOf("_sl") == -1 && location.href.indexOf("default.aspx") == -1 )  ) return;

	// if not silverlight installed jump to wmv page
	if( !Silverlight.isInstalled(null)){
		var urlName = location.href.split("/").reverse()[0].split(".")[0].split("_")[0];
		location.href = this.linkObject[urlName];
		if( urlNumber == undefined ) throw new Error("ファイル名が一致しません");
	}
	
}


CheckJs.prototype = {
	jumpToContent: function(vol,e){
		
		var isSlInstall = Silverlight.isInstalled(null) ? "sl" : "wmv";
		var targetPage = this.getCurrentPage();
				
		if( e.href  ) e.href = "javascript:void(0)";
		
		// check ie 6
		if( navigator.userAgent.indexOf("MSIE 6.") >= 0){
			e.href =this.linkObject[targetPage][isSlInstall][vol];
			return;
		}
		
		
		//alert( this.linkObject[targetPage][isSlInstall][vol] );
		
		location.href = this.linkObject[targetPage][isSlInstall][vol];
	},
	
	getCurrentPage: function(){
		var uriArray = location.href.split("/");
		var currentUri = uriArray[uriArray.length-1].split(".")[0];
		if( currentUri == "default" ){
			return currentUri;
		}else if(currentUri.indexOf("_sl") != -1){
			return "_sl";
		}else if(currentUri.indexOf("_wmv") != -1){
			return "_wmv";
		}else{
			return "_sl";
		}
	},
	
	toString:function(){
		return "checkJs";
	}
}


var c = new CheckJs();


var trackWrapper = function( st ){

	var args = st.split("(")[1].split(")")[0];

	setTimeout(function(){
		dcsMultiTrack.apply(this,args.split(","))
		}
	,5000);
}


//trackWrapper("dcsMultiTrack('DCS.dcssip','www.microsoft.com','DCS.dcsuri','/japan/windows/possibilities/scenario/B01.track','WT.ti','home＞Busy','WT.dl','0','WT.ad','','WT.si_p','')");
	
// dcsMultiTrack('DCS.dcssip','www.microsoft.com','DCS.dcsuri','/japan/windows/possibilities/scenario/B01.track','WT.ti','home＞Busy','WT.dl','0','WT.ad','','WT.si_p','')