﻿// added marquee by liuying at 2009.07.07 only IE version
var marqueeContent=getnews(); 

var marqueeInterval=new Array(); 
var marqueeId=0; 
var marqueeDelay=1800; 
var marqueeHeight=25; 


function getnews(){
	var marqueeContent=new Array(); 
	
	if (window.ActiveXObject){
     		xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
	}else{
  	 	if(document.implementation&&document.implementation.createDocument){
 				xmlDoc=document.implementation.createDocument("","doc",null);
		}
	}
	xmlDoc.async = "false"; 
	xmlDoc.load("uchannews.txt");	
	lt=xmlDoc.documentElement.childNodes.length;
	
	for (i=1;i<=lt;i++)
		marqueeContent[i-1]=xmlDoc.documentElement.selectSingleNode("/news_list/news[@xml:id='"+i+"']").text;	
		
	return marqueeContent;
	} 	


function initMarquee() { 
		if(marqueeContent.length==0){			
			return;
		}
		var str=marqueeContent[0]; 
		if(marqueeContent.length==1){
			//document.write('<div id="marqueeBox"><marquee scrollamount=\'marqueeDelay\'direction=left onmouseover="this.stop()" onmouseout="this.start()">'+str+'</marquee></div>');
			document.write('<div id="marqueeBox"><marquee scrollamount=2 direction=left onmouseover="this.stop()" onmouseout="this.start()">'+str+'</marquee></div>');
			return;
		}
    document.write('<div id="marqueeBox" onmouseover="clearInterval(marqueeInterval[0]);hscroll(this);" onmouseout="marqueeInterval[0]=setInterval(\'startMarquee()\',marqueeDelay);hscrollstop(this);"><div>'+str+'</div></div>'); 
    marqueeId++; 
    marqueeInterval[0]=setInterval("startMarquee()",marqueeDelay); 
} 
function startMarquee() { 
    var str=marqueeContent[marqueeId]; 
    marqueeId++; 
    if(marqueeId>=marqueeContent.length) marqueeId=0; 
    
    if(document.getElementById("marqueeBox").childNodes.length==1) { 
    	var nextLine=document.createElement('DIV'); 
    	nextLine.innerHTML=str; 
    	document.getElementById("marqueeBox").appendChild(nextLine); 
    } 
    else { 
        document.getElementById("marqueeBox").childNodes[0].innerHTML=str; 
        document.getElementById("marqueeBox").appendChild(document.getElementById("marqueeBox").childNodes[0]); 
        document.getElementById("marqueeBox").scrollTop=0;         
    }     
    clearInterval(marqueeInterval[1]); 
    marqueeInterval[1]=setInterval("scrollMarquee()",20); 
    
} 
function scrollMarquee() { 
    document.getElementById("marqueeBox").scrollTop++; 
    if(document.getElementById("marqueeBox").scrollTop%marqueeHeight==(marqueeHeight-1)){
    clearInterval(marqueeInterval[1]); 
    } 
}
function hscrollstop(o){
//	alert(marqueeInterval[2]);
	clearTimeout(marqueeInterval[2]);  
	o.lastChild.style.marginLeft='0px';
	o.firstChild.style.marginLeft='0px';
	}
	
function hscroll(o){ 			
    var w1=o.lastChild.offsetWidth,w2=o.offsetWidth;   	
    if(w1<=w2) return; 		
			hs(o,w1-w2,0,w1-w2);
}

function hs(o,d,c,p){ 
	//o object
	//d from
	//c currentlength
	//p length
    c++;
    var t=(c>0?-c:c);
    o.lastChild.style.marginLeft=t+'px';
    if(c==d){
    			o.lastChild.style.marginLeft='0px';
    			hs(o,p,0,p);
    		} 
    else marqueeInterval[2]=window.setTimeout(function(){hs(o,d,c,p)},1);
}
// end.


document.writeln("<table cellspacing=\'0\' cellpadding=\'0\' width=\'100%\' border=\'0\' >");
document.writeln("<tbody>");
document.writeln("<tr>");
document.writeln("<td width=\'211\' rowspan=\"2\" valign=\'top\'><a href=\'Cltindex.aspx?AllData=1\' style=\'border:0px solid #ccc\'><img src=\'images\/loge.jpg\' width=\'211\' height=\'78\' \/><\/td>");
document.writeln("<td rowspan=\"2\" valign=\'top\' >&nbsp;<\/td>");
document.writeln("");
document.writeln("<td width=\'720\' valign=\'top\'>");
document.writeln("<div id=\'topright\'>");
document.writeln("<div id=\'div_guest\' valign=\'top\'>");
document.writeln("    <table width=\'100%\' border=\'0\' cellspacing=\'2\' cellpadding=\'0\' class=\'topright\' valign=\'top\'>");
document.writeln("    <tr valign=\'top\'>");
document.writeln("    <td>");
document.writeln("    <a href=\'CltUserShoppingCart.aspx\' onmouseout=\'MM_swapImgRestore()\' onmouseover=\"MM_swapImage(\'ImageE\',\'\',\'images\/buyc.jpg\',1)\"><img src=\'images\/buy.jpg\' name=\'ImageE\' width=\'94\' height=\'27\' border=\'0\' id=\'Image14\' \/><\/a><\/td>");
document.writeln("    ");
document.writeln("    <td>会員ID<\/td>");
document.writeln("    <td><input type=\'text\' name=\'textfield\' id=\'txtUserName\' style=\'width:60px\' \/><\/td>");
document.writeln("    <td>パスワード<\/td>");
document.writeln("    <td><input type=\'password\' name=\'textfield2\' id=\'txtPassword\' style=\'width:60px\' onkeypress=\'userLogin()\'\/><\/td>");
document.writeln("    <td><a href=\'#\' onclick=\'UserLoginCheck()\'><img src=\'images\/enter.jpg\' width=\'70\' height=\'21\' \/><\/a><\/td>");
document.writeln("    <td><span  style=\'font-size:9px; \'><a href=\'#\' onclick=\"window.open(\'CltUserForgetPassword.aspx\', \'CltUserRegister\',\'\')\">パスワードをお忘れの方<\/a><\/span><\/td>");
document.writeln("    ");
document.writeln("    <\/tr>");
document.writeln("    <\/table>");
document.writeln("<\/div>");
document.writeln("<\/div>");
document.writeln("<div id=\'topright2\'  valign=\'top\'>");
document.writeln("    <table width=\'100%\' border=\'0\' cellspacing=\'4\' cellpadding=\'0\' valign=\'top\'>");
document.writeln("    <tr valign=\'top\'>");
document.writeln("      <td><img src=\'images\/icon_03.jpg\'\/><\/td>");
document.writeln("      <td>");
document.writeln("      <a href=\'#\' onclick=\"window.open(\'CltUserRegister.aspx\', \'CltUserRegister\',\'\')\">新規会員登録<\/a>		                                   <\/td>");
document.writeln("    <\/tr>");
document.writeln("    <\/table>");
document.writeln("<\/div> ");
document.writeln("");
document.writeln("<div id=\'div_userLogin\' style=\'display:none\'>");
document.writeln("    <table width=\'100%\' border=\'0\' cellpadding=\'0\' cellspacing=\'0\'>");
document.writeln("    <tr>");
document.writeln("     <td class =\'wite\' >");
document.writeln("    <a href=\'CltUserShoppingCart.aspx\' onmouseout=\'MM_swapImgRestore()\' onmouseover=\"MM_swapImage(\'ImageY\',\'\',\'images\/buyc.jpg\',1)\"><img src=\'images\/buy.jpg\' name=\'ImageY\' width=\'94\' height=\'27\' border=\'0\' id=\'Image14\' \/><\/a><\/td>");
document.writeln("    <td width=\'10\' class =\'wite\' >&nbsp; <\/td>");
document.writeln("    <td width=\'180\' class =\'wite\' >会員ID&nbsp;<strong><font color=\'#fe9601\'><span id=\'userWelcome\' >ｘｘｘｘxｘ<\/span><\/font><\/strong>&nbsp;でログイン中<\/td>");
document.writeln("    <td width=\'119\' align=\'center\' style=\'color:#FFFFFF\'  ><a href=\'CltUserInfo.aspx\'>会員情報<\/a><\/td>");
document.writeln("    <td width=\'158\'class =\'wite\' ><a href=\'#\' onmouseout=\'MM_swapImgRestore()\' onmouseover=\"MM_swapImage(\'btnLogout\',\'\',\'images\/botton_dd.jpg\',1)\" onclick=\'UserLoginOut()\'><img src=\'images\/bottom-top-6.gif\' name=\'btnLogout\' width=\'58\' height=\'20\' hspace=\'5\' border=\'0\' align=\'absmiddle\' id=\"btnLogout\"\/><\/a><\/td>");
document.writeln("    <td ><img src=\'images\/icon_06.jpg\'\/><a href=\'Cltchina-hotels7.aspx\' >予約内容を見る<\/a><\/td>");
document.writeln("    <\/tr>");
document.writeln("    <\/table>");
document.writeln("<\/div>");
document.writeln("<\/td>");
document.writeln("");
document.writeln("<\/tr>");
document.writeln("<tr>");
document.writeln("  <td valign=\'top\'>");
initMarquee();
document.writeln("  <\/td>");
document.writeln("<\/tr>");
document.writeln("<\/tbody>");
document.writeln("<\/table>")


function userLogin()
{
	if (13 == window.event.keyCode)
	{
		event.keyCode=9
		UserLoginCheck();
	}
}



function showUserInfo(userId)
{
	if ("" != userId)
	{
		document.getElementById("div_guest").style.display = "none";
		document.getElementById("div_userLogin").style.display = "";
	　　document.getElementById("userWelcome").innerText = userId;
	    document.getElementById("topright2").style.display = "none";
		
	}
	else
	{
		document.getElementById("div_guest").style.display = "";
		document.getElementById("div_userLogin").style.display = "none";
	    document.getElementById("topright2").style.display = "block";
		
	}
}
