/*
WinOpen
----------------------------------------------------
<a href="popup.html" target="_blank" onClick="WinOpen(this.href,550,600); return false;"></a>
*/
function WinOpen(src,width,height){
   if(! WinOpen.arguments[1]) width  = 500;
   if(! WinOpen.arguments[2]) height = 500;
   var wo = window.open(src,"_blank","toolbar=yes,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,resizable=yes,width=" + width + ",height=" + height);
   wo.window.focus();
}

/*
WinClose
----------------------------------------------------
<a href="javascript:void(0)" onClick="WinClose()"></a>
*/
function WinClose(){
   self.window.close();
}


/*自動バナー用
----------------------------------------------------*/
function price_disp(price){
	if (price != ""){
		for(var i = 0; i < price.length; i++){
			if(isNaN(price.charAt(i))){
				document.write("<img src='http://static.shareee.jp/img/bnr_num_comma.jpg' alt="," />");
			}else{
				document.write("<img src='http://static.shareee.jp/img/bnr_num_" + price.charAt(i) + ".jpg' alt='" + price.charAt(i) + "' />");
			}
		}		
	}
}

//エボック秒の時間変換（ho:時間、mi分、se:秒）
function calc_time(difftime, systime, start_time, now) {
    var datearray = new Array(3);
    var now = systime * 1000 + (now - start_time);
    
    for (i=0; i<=2; i++) {
        datearray[i] = "00";
    }
    
    // 秒をミリ秒に変換
    nokori = (difftime * 1000) - now;
    
    if (nokori < 0 ) {
        return datearray;
    }
    // 秒に修正
    nokori = Math.floor(nokori / 1000);
    
    ho = Math.floor(nokori / 3600);
    mi = Math.floor((nokori - (ho * 3600)) / 60);
    se = nokori - (ho * 3600) - (mi * 60);
    
    if (ho < 10) {
        ho = "0" + ho;
    }
    if (mi < 10) {
        mi = "0" + mi;
    }
    if (se < 10) {
        se = "0" + se;
    }
    
    datearray[0] = ho;
    datearray[1] = mi;
    datearray[2] = se;
    
    return datearray;
} 

