function setYear(){
	var d_obj = new Date();
	document.write(d_obj.getFullYear());
}

function swf_object(SWF,WID,HEI){
	document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width='+ WID +' height='+ HEI +'>');
	document.write('<param name="allowScriptAccess" value="sameDomain" />');
	document.write('<param name="allowFullScreen" value="false" />');
	document.write('<param name="movie" value="'+ SWF +'.swf" />');
	document.write('<param name="quality" value="high" />');
	document.write('<param name="bgcolor" value="#000000" />');
	document.write('<param name="wmode" value="transparent" />');
	document.write('<embed src="'+ SWF +'.swf" quality="high" wmode="transparent" bgcolor="#000000" width='+ WID +' height='+ HEI +' name="coverflow" align="middle" allowScriptAccess="sameDomain" allowFullScreen="false" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');
	document.write('</object>');
}


function init() {
	crossfade("pickuplist",1000,3000);
	winClose();
	smartRollover();
	setPng();
	setPng2();
	//setclassPng();
	setMovie();
	border_none();
	IE_logo_link();
	IE_logo_link2()
	prepareLinks();
	photoChange();

}

window.onload=init;


function winClose(){
	if(!document.getElementById("close")){
		return false;
	}
	var btnClose = document.getElementById("close");
	btnClose.onclick = function(){
		window.close();
	}
}
//png透過セット
function setPng(){
	if(!document.getElementById("logo") ){
		return false;
	}
	if(navigator.appVersion.indexOf("MSIE 6",0) != -1){
		var alpha_logo = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src='images/logo.png')";
		var alpha_time = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src='images/time.png')";
		var alpha_tel = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src='images/tel.png')";
		Png("logo",413,61,alpha_logo);
		Png("time",183,33,alpha_time);
		Png("tel",194,27,alpha_tel);

	}
}

function setPng2(){
	if(!document.getElementById("logo2") ){
		return false;
	}
	if(navigator.appVersion.indexOf("MSIE 6",0) != -1){
		var alpha_logo = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src='../images/logo.png')";
		var alpha_time = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src='../images/time.png')";
		var alpha_tel = "progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale,src='../images/tel.png')";
		Png("logo2",413,61,alpha_logo);
		Png("time",183,33,alpha_time);
		Png("tel",194,27,alpha_tel);

	}
}

function Png(pngID,WIDTH,HEIGHT,ALPHA){
	if(document.all){
		document.getElementById(pngID).style.width = WIDTH+"px";
		document.getElementById(pngID).style.height = HEIGHT+"px";
		document.getElementById(pngID).style.filter = ALPHA;
		document.getElementById(pngID).firstChild.style.display = "none";
	}
}




function classPng(pngClass,WIDTH,HEIGHT,ALPHA){
	var alphaArray = document.getElementsByTagName("li");
	for(i=0;i<alphaArray.length;i++){
		if(alphaArray[i].getAttribute("className") == pngClass || alphaArray[i].getAttribute("class") == pngClass){
			alphaArray[i].style.width = WIDTH+"px";
			alphaArray[i].style.height = HEIGHT+"px"
			alphaArray[i].style.filter = ALPHA;
			alphaArray[i].firstChild.style.display = "none";
		}
	}
}
//ieロゴリンク
function IE_logo_link(){
	if(document.getElementById("logo")){
		if(navigator.appVersion.indexOf("MSIE") != -1){
			document.getElementById("logo").onclick = function(){
				location.href = "top.html";
			}
		}
	}
}
function IE_logo_link2(){
	if(document.getElementById("logo2")){
		if(navigator.appVersion.indexOf("MSIE") != -1){
			document.getElementById("logo2").onclick = function(){
				location.href = "../top.html";
			}
		}
	}
}
	
//ロールオーバーイメージ
function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");

		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("_out."))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_out.", "_over."));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_over.", "_out."));
				}
			}
		}
	}
}

function photoChange(){

	if(!document.getElementById("image")){
		return;
	}
	
	
	var base = document.getElementById("image").getElementsByTagName("img")[0];
	base.style.display = "none";

	var imageList = new Array();
	for(i=1;i<=4;i++){
//		//imageList[i] = document.createElement("img");
		tmpImage = new Image();
		tmpImage.src = "pic0"+i+".jpg";
		imageList.push(tmpImage);
	}

	if(imageList[0].width > 300){
		base.style.marginBottom = "-50px";
		base.style.marginTop = "50px";
	}
	base.style.display = "";

	var sumArray = document.getElementsByTagName("img");
	for(i=0;i<sumArray.length;i++){

		if(sumArray[i].className == "thumb"){

			sumArray[i].onmouseover = function(){

				var targetImg = document.getElementById("image").getElementsByTagName("img")[0];

				var tmpSrc = this.src.split("thumb0");
				var tmpNumber = tmpSrc[1].split(".");
				var srcNumber = tmpNumber[0]-1;
				//var targetSrc = "pic"+tmpSrc[1];

				targetImg.src = imageList[srcNumber].src;
				
				if(imageList[srcNumber].height == 300){
					targetImg.style.marginTop = "50px";
				}else{
					targetImg.style.marginTop = "0";
				}
			
			}
		
		}
	
	}
}

function setMovie(){

	if(!document.getElementById("movie")){
		return false;
	}

	var tmp_id = location.href.split("ladies/")[1];
	var lady_id = tmp_id.split("/")[0];
	var movieBtn = document.getElementById("movie");
	movieBtn.getElementsByTagName("a")[0].removeAttribute("href");
	movieBtn.style.cursor = "pointer";
	movieBtn.onclick = function(){
		window.open("../swf/movie.swf?path=../movie/"+lady_id+".flv","movie","width=430,height=410");
	}
}

function border_none(){
	var all_link = document.links;
	for(i=0;i<all_link.length;i++){
		all_link[i].onfocus = function(){
			this.blur();
		}
	}
}


function prepareLinks() {
	if(!document.getElementsByTagName){
		return false;
	}
	var links = document.getElementsByTagName("a");
	for (var i=0; i<links.length; i++) {
		if(links[i].getAttribute("className") == "popup" || links[i].getAttribute("class") == "popup") {
			links[i].onclick = function() {
				popUp(this.getAttribute("href"));
				return false;
			}
		}
	}
}
function popUp(winURL) {
	var winFocus;
	winFocus = window.open(winURL,"popup","width=668,height=600,scrollbars=yes");
    winFocus.focus();
}





function crossfade(IDname , fadetime , speed){
	if(!document.getElementById(IDname)){
		return;
	}
	var news = document.getElementById(IDname);
	var newslinks = news.getElementsByTagName("li");
	for(var i=0; i<newslinks.length; i++){
		newslinks[i].id = [i];
		newlength = new Array([i]);
	}
	for(var j=0; j<newslinks.length; j++){
		newlength[j]=[j];
	}
	new Crossfader(newlength, fadetime, speed );
}

var useBSNns;

if (useBSNns){
	if (typeof(bsn) == "undefined")
		bsn = {}
	var _bsn = bsn;
}else{
	var _bsn = this;
}

_bsn.Crossfader = function (divs, fadetime, delay ){
	this.nAct = -1;
	this.aDivs = divs;
	
	for (var i=0;i<divs.length;i++){
		document.getElementById(divs[i]).style.opacity = 0;
		document.getElementById(divs[i]).style.position = "absolute";
		document.getElementById(divs[i]).style.filter = "alpha(opacity=0)";
		document.getElementById(divs[i]).style.visibility = "hidden";
	}
	
	this.nDur = fadetime;
	this.nDelay = delay;
	this._newfade();
}

_bsn.Crossfader.prototype._newfade = function(){
	if (this.nID1)
		clearInterval(this.nID1);
	
	this.nOldAct = this.nAct;
	this.nAct++;
	if (!this.aDivs[this.nAct])	this.nAct = 0;
	
	if (this.nAct == this.nOldAct)
		return false;
	
	document.getElementById( this.aDivs[this.nAct] ).style.visibility = "visible";
	
	this.nInt = 50;
	this.nTime = 0;
	
	var p=this;
	this.nID2 = setInterval(function() { p._fade() }, this.nInt);
}

_bsn.Crossfader.prototype._fade = function(){
	this.nTime += this.nInt;
	
	var ieop = Math.round( this._easeInOut(this.nTime, 0, 1, this.nDur) * 100 );
	var op = ieop / 100;
	document.getElementById( this.aDivs[this.nAct] ).style.opacity = op;
	document.getElementById( this.aDivs[this.nAct] ).style.filter = "alpha(opacity="+ieop+")";
	
	if (this.nOldAct > -1){
		document.getElementById( this.aDivs[this.nOldAct] ).style.opacity = 1 - op;
		document.getElementById( this.aDivs[this.nOldAct] ).style.filter = "alpha(opacity="+(100 - ieop)+")";
	}
	
	if (this.nTime == this.nDur){
		clearInterval( this.nID2 );
		
		if (this.nOldAct > -1)
			document.getElementById( this.aDivs[this.nOldAct] ).style.visibility = "hidden";
		
		var p=this;
		this.nID1 = setInterval(function() { p._newfade() }, this.nDelay);
	}
}

_bsn.Crossfader.prototype._easeInOut = function(t,b,c,d){
	return c/2 * (1 - Math.cos(Math.PI*t/d)) + b;
}
