// make unique id

function count() {
	 id = getCookie("Id");
	 if (id == "") {
	         today  = new Date();
		 y = today.getFullYear();
		 m = to2String(today.getMonth() + 1);
		 d = to2String(today.getDate());
		 h = to2String(today.getHours());
		 mm = to2String(today.getMinutes());
	     id = Math.floor(Math.random()*10000000000);
	     lastid = y+m+d+h+mm+id;	     
	     setCookie("Id", lastid);
	 }
}
function getCookie(key,  tmp1, tmp2, xx1, xx2, xx3) {
    tmp1 = " " + document.cookie + ";";
    xx1 = xx2 = 0;
    len = tmp1.length;
    while (xx1 < len) {
        xx2 = tmp1.indexOf(";", xx1);
        tmp2 = tmp1.substring(xx1 + 1, xx2);
        xx3 = tmp2.indexOf("=");
        if (tmp2.substring(0, xx3) == key) {
            return(unescape(tmp2.substring(xx3 + 1, xx2 - xx1 - 1)));
        }
        xx1 = xx2 + 1;
    }
    return("");
}
function setCookie(key, val, tmp) {
    tmp = key + "=" + escape(val) + "; ";
    tmp += "expires=Tue, 31-Dec-2030 23:59:59; ";
    tmp += "path=/; ";
    document.cookie = tmp;
}
function clearCookie(key) {
    document.cookie = key + "=" + "xx; expires=Tue, 1-Jan-1980 00:00:00;";
}
function to2String(value){
	 label=""+value;
	 if(label.length<2){
		label="0"+label;
	 }
	 return label;
}


function openSubWin(url, wx, wy) { 
	x = (screen.width - wx) / 2;
	y = (screen.height - wy) / 2 - 40;
	var options = "scrollbars=0,status=0,toolbar=0,left=" + x + ",top=" + y + ",width=" + wx + ",height=" + wy;
	window.open(url,'hanrei',options);
}


function getWindowHeight()
{
	var height;
	if( height=window.innerHeight ) {
		return( height );
	}
	else if( height=document.documentElement.clientHeight ) {
		return( height );
	}
	else if( height=document.body.clientHeight) {
		return( height );
	}
	else {
		return 0;
	}
}

function getWindowWidth()
{
	var width;
	if( width=window.innerWidth ) {
		return( width );
	}
	else if( width=document.documentElement.clientWidth ) {
		return( width );
	}
	else if( width=document.body.clientWidth) {
		return( width );
	}
	else {
		return 0;
	}
}


// Write Flash

function WriteSWF_trans(swf, width, height, flashvars) {

	var chDate = '0816';

	var code = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width=';
	code += width + ' height=' + height;
	code +=	'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0">\n';
	code += '<param name="bgcolor" value="#ffffff">\n';
	code += '<param name="flashvars" value="chDate=' + chDate + flashvars + '">\n';
	code += '<param name="MOVIE" value="' + swf + '">\n';
	code += '<param name="PLAY" value="true">\n';
	code += '<param name="LOOP" value="false">\n';
	code += '<param name="QUALITY" value="best">\n';
	code += '<param name="MENU" value="false">\n';
	code += '<param name="SCALE" value="noscale">\n';
	code += '<param name="BASE" value="http://weathernews.jp">\n';
	code += '<param name="WMODE" value="transparent">\n';

	code += '<embed src="' + swf + '"\n';
	code += 'width="' + width + '"\n';
	code += 'height="' + height + '"\n';
	code += 'PLAY="true"\n';
	code += 'MENU="false"\n';
	code += 'LOOP="false"\n';
	code += 'QUALITY="best"\n';
	code += 'BGCOLOR="#ffffff"\n';
	code += 'flashvars=MainMenu=2&chDate=' + chDate;
	code += 'type="application/x-shockwave-flash"\n';
	code += 'BASE="http://weathernews.jp"\n';
	code += 'wmode="transparent"\n';
	code +=	'PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer">\n';
	code += '</embed>\n</object>\n';

	document.write(code);
}


