function makeChild (url, windowname, width, height) {
		var features = "location=no, menubar=no, status=yes, scrollbars=yes, resizable=yes, toolbar=no";
		if (width) {
			if (window.screen.width > width)
			features += ", left=" + (window.screen.width-width)/2;
			else width = window.screen.width;
			features += ", width=" + width;
		}
		if (height) {
			if (window.screen.height > height)
			features += ", top=" + (window.screen.height-height)/2;
			else height = window.screen.height;
			features += ", height=" + height;
		}
		var newWindow = window.open (url, windowname, features);
		newWindow.focus();
}

function rollover() {
	if (!document.getElementsByTagName) return false;
	var image = document.getElementsByTagName("img");
	for (i=0; i<image.length; i++) {
		if (image[i].getAttribute("src").match(/_off\./)){
	 		image[i].onmouseover = function() {
	 			this.setAttribute("src", this.getAttribute("src").replace("_off.","_ov."));
	 		}
	 		image[i].onmouseout = function() {
	 			this.setAttribute("src", this.getAttribute("src").replace("_ov.","_off."));
	 		}
		}
	}
}
function offradio() {
   var ElementsCount = document.sample.elements.length; // ラジオボタンの数
   for( i=0 ; i<ElementsCount ; i++ ) {
      document.sample.elements[i].checked = false;
   }
}
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()+";";
   mydomain = " bansoreicha.jp; ";
   //mydomain = " 211.9.240.103; ";
   mypath = " path=/; ";
   document.cookie =  myItem + myExpires + mypath;
}

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;
}
function myGetCookie2(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;
}
function loadcookie(){
	myD       = new Date();
	mytime    = myD.getTime();
	var ransu = Math.floor(Math.random()*100000000);
	myUser = myGetCookie("USER_NAME");
	if (myUser == null){// 初めての訪問
   			myUser   = mytime+"/"+ransu;
			mySetCookie("USER_NAME",myUser,365);// 名前保存
			myCount = 1;
	}
}


// HTTP通信用、共通関数
function createXMLHttpRequestlog()
{
    var XMLhttpObject = null;

    try{
        XMLhttpObject = new XMLHttpRequest();
    }catch(e){
        try{
            XMLhttpObject = new ActiveXObject("Msxml2.XMLHTTP");
        }catch(e){
            try{
                XMLhttpObject = new ActiveXObject("Microsoft.XMLHTTP");
            }catch(e){
                return null;
            }
        }
    }
    return XMLhttpObject;
}


function logwright(note4,note5){
	//var ajax = new Ajax.Request('http://bansoreicha.jp/log.php', { method:'post', parameters: 'note4='+escape(note4)+'&note5='+escape(note5)+'&page='+escape(location.href), onComplete: success});
	//var ajax = new Ajax.Request('http://bansoreicha.jp/log.php', { method:'post', parameters: 'note4='+escape(note4)+'&note5='+escape(note5)+'&page='+escape(location.href), onComplete: success});
}
function success(a){
	/*alert(a.responseText);*/
}


function log(){
	var note4 = myGetCookie2("LOGINCHECK");
	var note5 = myGetCookie2("HCHECK");
	if(note4 != null && note5 != null){
		logwright(note4, note5);
	}
}
function addLoadEvent(func) {
	var oldonload = window.onload;
	if (typeof window.onload != 'function') {
		window.onload = func;
	}else {
		window.onload = function() {
		oldonload();
		func();
		}
	}
}

addLoadEvent(rollover);
addLoadEvent(loadcookie);
addLoadEvent(log);
