function check(){
	if(confirm("送信して宜しいですか？")){ return true; }else{ return false; }
}

function changePhoto(image,hostUrl){
	$("girlMainPhoto").src = '../data/girl/300x450/' + image;
}
function changeEvent(image){
	clearInterval(eventTimer);
	eventData = document.getElementById("EventMainPhoto");
	eventData.src = '../data/event_top/' + image;
}

function changeEventRoutation(image1,image2,image3){
		nowDateTime = new Date();
		nowDateSecond = nowDateTime.getSeconds();
		
		randomImgNo = Math.floor(1 + Math.random(nowDateSecond) * 3);
		switch(randomImgNo){
			case 1:
			if(image1 != null){
				pickImg = image1;
			}
			break;		
			case 2:
			if(image2 != null){
				pickImg = image2;
			}
			break;		
			case 3:
			if(image3 != null){
				pickImg = image3;
			}
			break;		
		}
		if(pickImg){
		eventData = document.getElementById("EventMainPhoto");
		eventData.src = '../data/event_top/' + pickImg;
		}
}
function changeEventStart(img1,img2,img3){
	
	image1 = img1;
	image2 = img2;
	image3 = img3;

eventTimer = setInterval('changeEventRoutation(image1,image2,image3)',1500);
	return eventTimer;
}

function changePhotoS(image){
	$("girlMainPhoto").src = '../../data/girl/300x450/' + image;
}
function changeEventS(image){
	clearInterval(eventTimer);
	eventData = document.getElementById("EventMainPhoto");
	eventData.src = '../../data/event_top/' + image;
}

function changeEventRoutationS(image1,image2,image3){
		nowDateTime = new Date();
		nowDateSecond = nowDateTime.getSeconds();
		
		randomImgNo = Math.floor(1 + Math.random(nowDateSecond) * 3);
		switch(randomImgNo){
			case 1:
			if(image1 != null){
				pickImg = image1;
			}
			break;		
			case 2:
			if(image2 != null){
				pickImg = image2;
			}
			break;		
			case 3:
			if(image3 != null){
				pickImg = image3;
			}
			break;		
		}
		if(pickImg){
		eventData = document.getElementById("EventMainPhoto");
		eventData.src = '../../data/event_top/' + pickImg;
		}
}
function changeEventStartS(img1,img2,img3){
	
	image1 = img1;
	image2 = img2;
	image3 = img3;

eventTimer = setInterval('changeEventRoutationS(image1,image2,image3)',1500);
	return eventTimer;
}



var Marquee = function ( id, opt ){
    if( ! document.getElementById(id) ) throw 'invalid id. [' + id + ']';
    var option = opt || {};
    this.id     = id;
    this.amount = option.amount || 3;
    this.delay  = option.delay  || 100;
    this.position = Number.POSITIVE_INFINITY; // means out of range.
    this._wrap();
    this.start();
}

Marquee.prototype = {
    /* wrap child nodes */
    _wrap : function() {
        var t = document.getElementById( this.id );
        with ( t.style ){
            position = 'relative'; // for ie6.
            overflow = 'hidden';
        }
        var w = document.createElement( 'div' );
        with ( w.style ){
            margin     = '0';
            padding    = '0';
            background = 'transparent';
            border     = 'none';
        }
        t.normalize();
        while( t.firstChild ){
            w.appendChild( t.removeChild( t.firstChild ) );
        }
        t.appendChild(w);
        /* get minimum width. */
        w.style.position = 'absolute';
        this.minWidth = w.offsetWidth;
        /* put back */
        w.style.position = 'relative';
        w.style.width = '100%'; // for ie6.
    },
    start : function() {
        this.stop();
        this._next();
		},
    _next : function() {
				var t = document.getElementById( this.id );
        this.curWidth = Math.min(t.offsetWidth,t.parentNode.offsetWidth); // dirty. (for "overflow:hidden" parent)
        this.position = this.position - this.amount;
        if ( this._isOutOfRange() ) {
            this.position = this._startPosition();
        }
        var w = t.firstChild;
        w.style.left = this.position + 'px';
        var self = this;
				
        if(this.position < 3 && this.position > -2){
					this.position = this.position - this.amount;
        	this.stopID = window.setTimeout(
							function(){ self._next(); },
							2000
					);
        }else{
					clearInterval(this.stopID);
					this.tid = window.setTimeout(
							function(){ self._next(); },
							this.delay
					);
					
				}
    },
    _startPosition : function() {
        return ( this.amount > 0 ) ?  this.curWidth
                                   : -this.minWidth;
    },
    _isOutOfRange : function() {
        return this.position < -this.minWidth || this.curWidth < this.position;
    },
    stop : function() {
        if ( this.tid ) window.clearTimeout( this.tid );
        this.tid = null;
    },
    isMarqueeing : function() {
        return ( this.tid ) ? true : false;
    }
}
