// JavaScript Document
var winIndex = 1;
function winOpen(tagElement){
	url = tagElement.href;
	var winName = "win"+winIndex;
	window.open(url,winName,'');
	winIndex++;
	
}

function copyrightDisp(){
	var today = new Date();
	var thisYear = today.getFullYear();
	var copyright = "Copyright 1999-"+thisYear+", I.T.S. Music Studio All Right Reserved";
	document.getElementById('footer').innerHTML = copyright;
}
function leftMenuChange(menuObj,classvalue){
		document.getElementById(menuObj).setAttribute('class',classvalue);
		document.getElementById(menuObj).setAttribute('className',classvalue);
}
function centerLinkChange(menuObj,flag,bgcolor,border){
		if(flag){
			menuObj.style.setProperty('background-color',bgcolor,'');
			menuObj.style.setProperty('text-decoration','underline','');
			menuObj.style.setProperty('border',border,'');
		}else{
			menuObj.style.setProperty('background-color',bgcolor,'');
			menuObj.style.setProperty('text-decoration','none','');
			menuObj.style.setProperty('border',border,'');
		}
}

function closeArea(Obj,bgcolor,color){
	Obj.style.setProperty('background-color',bgcolor,'');
	Obj.style.setProperty('color',color,'');
}

function menuDisp(fileName){
	var xmlData = getXml(fileName);
	var menuText = "";
	for (var i = 0; i < xmlData.Menu.Item.length; i++){
		var v = i+1;
		if(v < 10){
			v = "0"+v;
		}
		var idName = "menu"+v;
		var url = xmlData.Menu.Item[i].Url;
		var menuName = xmlData.Menu.Item[i].Name;
		var class01 = "'"+"left_menu"+"'";
		var class02 = "'"+"left_menu2"+"'";
		menuText += '<a href="'+url+'" class="left_menu" id="'+idName+'" name="leftmenu" onmouseover="leftMenuChange(this.id,'+class02+')" onmouseout="leftMenuChange(this.id,'+class01+')">'+menuName+'</a>';
	}
	document.getElementById('menu').innerHTML = menuText;
}

function getXml(fileName){
	var http = new JKL.ParseXML(fileName);
	http.async();
	var xmlData = http.parse();
	return xmlData;
}

function goTopPage(){
	window.location.href = "http://www.its-music.com";
}

function rightContents(fileName){
	var xmlData = getXml(fileName);
	var rightText = "";
	for (var i = 0; i < xmlData.RightContents.Item.length; i++){
		rightText += '<div class="right">';
		if(xmlData.RightContents.Item[i].Image){
			rightText +='<img src="'+xmlData.RightContents.Item[i].Image.ImageSrc+'" alt="'+xmlData.RightContents.Item[i].Image.ImageAlt+'" border="0" /><br />';
		}
		rightText += '<div class="right_title">'+xmlData.RightContents.Item[i].Title+'</div>';
		rightText += '<div class="right_contents">'+xmlData.RightContents.Item[i].Contents;
		if(xmlData.RightContents.Item[i].Link){
			rightText += '<br /><a href="'+xmlData.RightContents.Item[i].Link.LinkUrl+'">'+xmlData.RightContents.Item[i].Link.LinkContents+'</a>';
		}
		rightText += '</div></div>';
	}
	rightText += '<div class="right">';
	rightText += '<div class="right_title">I.T.S. Music Studio チラシ印刷のサンプル</div>';
	rightText += '<div class="right_text" style="width:200px;margin-right:auto; margin-left:auto">';
	rightText += '<div class="right_contents" style="width:200;margin-right:auto;margin-left:auto">';
	rightText += '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="200" height="340">';
	rightText += '<param name="movie" value="../swf/dtp_sample.swf" />';
	rightText += '<param name="quality" value="high" />';
	rightText += '<embed src="../swf/dtp_sample.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="200" height="340"></embed>';
	rightText += '</object>';
	rightText += '</div>';
	rightText += '</div>';
	document.getElementById('right').innerHTML = rightText;
}

function sampleDisp(clickObj,dispObj){
	var imgString = new String(clickObj.src);
	if(imgString.indexOf("arrow_01.gif") >= 0){
		document.getElementById(dispObj).style.setProperty('display','block','');
		clickObj.src="../images/arrow_02.gif";
	}else{
		document.getElementById(dispObj).style.setProperty('display','none','');
		clickObj.src="../images/arrow_01.gif";
	}
}

function getWindowWidth(){
     var ua = navigator.userAgent;
     var nHit = ua.indexOf("MSIE");
     var bIE = (nHit >=  0);
     var bVer6 = (bIE && ua.substr(nHit+5, 1) == "6");
     var bStd = (document.compatMode && document.compatMode=="CSS1Compat");

     if (bIE) {
          if (bVer6 && bStd) {
               return document.documentElement.clientWidth;
          } else {
               return document.body.clientWidth;
          }
     } else {
          return window.innerWidth;
     }
}

function getWindowHeight(){
     var ua = navigator.userAgent;
     var nHit = ua.indexOf("MSIE");
     var bIE = (nHit >=  0);
     var bVer6 = (bIE && ua.substr(nHit+5, 1) == "6");
     var bStd = (document.compatMode && document.compatMode=="CSS1Compat");

     if (bIE) {
          if (bVer6 && bStd) {
               return document.documentElement.clientHeight;
          } else {
               return document.body.clientHeight;
          }
     } else {
          return window.innerHeight;
     }
}

function imageDisp(url){
	var title = "チラシサンプル";
	return GB_showImage(title, url)
}