function getCookie(cookieName){
        var search = cookieName + '=';
        if (document.cookie.length>0) {
                offset = document.cookie.indexOf(search);
                if (offset != -1){                                                                                                           offset += search.length;
                        end             = document.cookie.indexOf(';',offset);
                        if(end == -1)
                                end = document.cookie.length;                                                                                return unescape(document.cookie.substring(offset,end));
                }
        }
        return null;
}

function showD2PToolbar() {
      netia = getCookie('NetiA');
//        ml = '';
        if(netia) {
           // cForm = netia.split(":");
           // check = /.+@.+\..+/;
            //if (cForm[0].match(check)) {
		document.write('<div id="d2ptb"><iframe src="/d2ptb" width="100%" height="23" scrolling="no" frameborder="0"></iframe></div>');
//            }
        }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);

}

function loginbtn() {
//    user_status = getCookie('user_status');
    	netia = getCookie('NetiA');
	if(netia){
		document.write('<li class="logged">ログイン中</li>');
    	} else {
		document.write('<li><a href="http://members.1000giri.net/main.html">ログイン</a></li>');
    	}
}



function MM_showFlash(path, width, height, title) {
  document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0" width="'+width+'" height="'+height+'" title="'+title+'"><param name="movie" value="' + path + '" /><param name="quality" value="high" /><embed src="'+path+'" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="'+width+'" height="'+height+'"></embed></object>');
}

function Banner(p_hit, p_contents) {
	this.hit=p_hit;
	this.contents=p_contents;
}

function show_banner(banners) {
//	var now = new Date(); 
//	var h = now.getHours();

  //	m = 0, x = 0, y = 0;

  //	for(i=0; i<=banners.length - 1; i++) {
//		if( (h>=20 || h<=2) && banners[i].hit < 10) continue;
//	  	m += banners[i].hit;
  //	}
  	n = Math.floor(Math.random() * (banners.length - 1));
  	n++;
  
	for(i=0; i<=banners.length - 1; i++) {
		if( banners[i].hit < 10) continue;
  	  	x = y;
  	  	y += banners[i].hit;
  	  	if(x<n && n<=y) {
			document.write(banners[i].contents);
			return;
		}
	}
}

function flvplayer( id, flv, img, title, auto ){

        var so = new SWFObject('http://www.1000giri.net/swf/player-licensed.swf','mpl','700','413','9');
//        var so = new SWFObject('http://members.1000giri.net/swf/player-licensed.swf','mpl','700','413','9');
        so.addParam('allowscriptaccess','always');
        so.addParam('allowfullscreen','true');
//      so.addParam('flashvars','&file=/sample/movie/ayami_hd_sample_f.flv&title=My%20Video&image=/gallery/033ayami/images/swf_f.jpg&frontcolor=000000&lightcolor=000000&screencolor=EEEEEE');

        so.addVariable("file", flv);
        so.addVariable("title", title);
        so.addVariable("image", img );
        so.addVariable("frontcolor", "0x000000");
        so.addVariable("lightcolor", "0x000000");
        so.addVariable("screencolor", "0xeeeeee");
//		so.addVariable("streamscript","lighttpd");
//		so.addVariable("streamer","lighttpd");

		// Added on Apr.05,2011 //////////////
		so.addVariable("bufferlength","2");
		so.addVariable("provider","http");


        if(auto) { so.addVariable("autostart", "true"); }


        so.write('player');

}

