/*========== Flash ==========*/
function outputswf(path,bgcolor,w,h,vars){
	/*if(vars == undefined){ vers = ""; }*/
	var tagStr = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+w+'" height="'+h+'" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0">';
	tagStr += '<param name="allowScriptAccess" value="sameDomain">';
	tagStr += '<param name="movie" value="'+path+'">';
	tagStr += '<param name="quality" value="high">';
	tagStr += '<param name="bgcolor" value="'+bgcolor+'">';
	tagStr += '<param name="flashvars" value="'+vars+'">';
	tagStr += '<embed src="'+path+'" name="fContent" flashvars="'+vars+'" bgcolor="'+bgcolor+'" width="'+w+'" height="'+h+'" quality="high" align="middle" play="true" quality="high" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">';
	tagStr += '</embed>';
	tagStr += '</object>';
	document.write(tagStr);
}

/*========== font_size_control ==========*/
var Win=(navigator.userAgent.indexOf("Win")!=-1);
var Mac=(navigator.userAgent.indexOf("Mac")!=-1);

var an = navigator.appName
var ua = navigator.userAgent

//Netscape
var netscape = (an=="Netscape")
//Netscape6 や Mozilla(オープンソース版)
//     *ただしSafariがまじる
var gecko = (ua.indexOf("Gecko")!=-1)
//Netscape6のみ
var n6 = (ua.indexOf("Netscape6")!=-1)
//Netscape7のみ
var n7 = (ua.indexOf("Netscape7")!=-1)
//Internet Explorer
var ie = (an=="Microsoft Internet Explorer")
//Oprea6のみ
var o6 = (ua.search('opera(\ |\/)6') != -1)
//Oprea7のみ
var o7 = (ua.search('opera(\ |\/)7') != -1)
//Safariの場合
var saf = (ua.indexOf("Safari")!=-1)
//DreamPassport
var dp = (ua.indexOf("DreamPassport")!=-1)
//PS2 NetFront
var ps2nf = (ua.indexOf("AveFront")!=-1)

var rootPath = makepath();

if(Win){
	if(ie){
		document.write('<LINK rel="stylesheet" href="'+rootPath+'control/css/font_wi.css" type="text/css">');
	}else if(netscape){
		document.write('<LINK rel="stylesheet" href="'+rootPath+'control/css/font_wn.css" type="text/css">');
	}else{
		document.write('<LINK rel="stylesheet" href="'+rootPath+'control/css/font_wi.css" type="text/css">');
	}

}else if(Mac){
	if(saf){
		document.write('<LINK rel="stylesheet" href="'+rootPath+'control/css/font_ms.css" type="text/css">');
	}else if(ie){
		document.write('<LINK rel="stylesheet" href="'+rootPath+'control/css/font_mi.css" type="text/css">');
	}else if(netscape){
		document.write('<LINK rel="stylesheet" href="'+rootPath+'control/css/font_mn.css" type="text/css">');
	}else{
		document.write('<LINK rel="stylesheet" href="'+rootPath+'control/css/font_mi.css" type="text/css">');
	}
}else{
	document.write('<LINK rel="stylesheet" href="'+rootPath+'control/css/font_wi.css" type="text/css">');
}


/*========== make path ==========*/
function makepath() {
	var arryPath = new Array();
	var strPath = window.location.href;
	var domainFlg = 0;
	var curPath = "";

	split( strPath, "/", arryPath );

	for( var i=0; i<arryPath.length; i++ ){
		if( domainFlg == 1 && i!=arryPath.length-1 ){
			curPath += "../"
		}
		if((arryPath[i] == 'wacom.co.jp') || (arryPath[i] == 'www.wacom.co.jp')){
			var domainFlg = 1;
		}
	}
	return curPath;
}

/*========== Cookie ==========*/
function mySetCookie(myCookie,myValue,myDay){
	myExp = new Date();
	myExp.setTime(myExp.getTime()+(myDay*24*60*60*1000));
	myItem = "@" + myCookie + "=" + escape(myValue) + ";";
	myExpires = "expires="+myExp.toGMTString();
	document.cookie =  myItem + myExpires;
}

function myGetCookie(myCookie){
	myCookie = "@" + myCookie + "=";
	myValue = null;
	myStr = document.cookie + ";" ;
	myOfst = myStr.indexOf(myCookie);
	if (myOfst != -1){
		myStart = myOfst + myCookie.length;
		myEnd   = myStr.indexOf(";" , myStart);
		myValue = unescape(myStr.substring(myStart,myEnd));
	}
	return myValue;
}

/*========== split ==========*/
function split( str, deli, arr ) {
	var pos;
	var prepos = 0;
	var index = 0;
	var deli_length = deli.length;

	while((pos = str.indexOf(deli, prepos)) != -1) {
		arr[index++] = str.substring(prepos, pos);
		prepos = pos + deli_length;
	}
	arr[index] = str.substring(prepos);
}

/*========== pop up window ==========*/
function wopen1(page){
  window.open(page,"window1","toolbar=no,location=no,dirctory=no,status=yes,menubar=no,scrollbars=yes,resizable,width=520,height=620")
  <!--    window1.focus(); -->
  }

/*========== color_control ==========*/
wacomColors = new Array('yellow', 'green', 'blue', 'purple', 'pink');
defaultColor = 'yellow';

myColor = myGetCookie('WACOM_COLOR');
if( myColor == null) {
	mySetCookie('WACOM_COLOR',defaultColor,365);
}
for(i = 0; i < wacomColors.length; i++){
	if(wacomColors[i] == myColor){
		wacomColors.splice(i,1);
	}
}
rndNum = Math.floor(Math.random()*wacomColors.length);
newColor = wacomColors[rndNum];
mySetCookie('WACOM_COLOR',newColor,365);

document.write('<link href="'+rootPath+'control/css/color_'+newColor+'.css" rel="stylesheet" type="text/css">');
