
cfg = new Object();


//■ パス設定
function setPath(root_path, shop_id, shop_url ){

ContextMenu();

	if(root_path){ cfg['root_path'] = root_path; }
	if(shop_id){ cfg['shop_id'] = shop_id; }
	if(shop_url){ cfg['shop_url'] = shop_url; }
}


//++++++++++++++++++++++//
//■ レディーページ開く //
//++++++++++++++++++++++//
function Lady(shop_id, lady_id){

	if(!cfg['root_path']){ return false; }
	else if(!shop_id){ return false; }
	else if(!lady_id){ return false; }

	var ww = 800;
	var hh = 800;

	// 画面サイズの調整
	if(!ww){
		if(ww = screen.width){ ww = ww <= 1000 ? ww -= 100 : ww *= 0.9; }
	}
	if(!hh){
		if(hh = screen.height){ hh = hh <= 800 ? hh -= 100 : hh *= 0.9; }
	}
	win = window.open(cfg['root_path']+'lady/'+shop_id+'/'+lady_id+'/', "lady", "width="+ww+", height="+hh+", left=0, top=0, screenX=0, screenY=0, location=no, menubar=no, directories=no, status=no, resizable=no, scrollbars=no");
	win.focus();
}


//+++++++++++++++++++++++++++++//
//■ レディー画像 データセット //
//+++++++++++++++++++++++++++++//
function setLady(img1, img2, img3, img4, img5){

	cfg['img'] = new Array();
	var cnt = -1;
	if(img1){ cnt++; cfg['img'][cnt] = img1; }
	if(img2){ cnt++; cfg['img'][cnt] = img2; }
	if(img3){ cnt++; cfg['img'][cnt] = img3; }
	if(img4){ cnt++; cfg['img'][cnt] = img4; }
	if(img5){ cnt++; cfg['img'][cnt] = img5; }
	if(cfg['img'].length <= 1){
			GetUrl();
	}
	else if(cfg['img'].length > 1){
		LadyNext(1);
	}
}


//++++++++++++++++++++//
//■ レディー画像出力 //
//++++++++++++++++++++//
function LadyImg(no){

	// 画像出力
	if(cfg['img'][no]){
		document.images['galImg'].src = cfg['root_path']+"shops/"+cfg['shop_id']+"/"+cfg['img'][no];
	}

	// Next Backボタンのコントロール
	if(no == 0){
		document.getElementById('back').innerHTML = '';	// BACKボタン消す
	}
	if(no > 0){
		LadyBack(no-1);	// BACKボタン
	}
	if(cfg['img'].length > no){
		LadyNext(no+1);	// NEXTボタン
	}
	if(cfg['img'].length == (no+1)){
		GetUrl();	// NEXTボタン消す
	}
}


//+++++++++++++++++++//
//■ BACKボタン 出力 //
//+++++++++++++++++++//
function LadyBack(no){
	document.getElementById('back').innerHTML = '<a href="#" onclick="LadyImg('+no+');">BACK</a>';
}

//+++++++++++++++++++//
//■ NEXTボタン 出力 //
//+++++++++++++++++++//
function LadyNext(no){
	document.getElementById('next').innerHTML = '<a href="#" onclick="LadyImg('+no+');">NEXT</a>';
}
//+++++++++++++++++++//
//■ SHOPボタン 出力 //
//+++++++++++++++++++//
function GetUrl(){
	document.getElementById('next').innerHTML = '<a href="'+cfg['shop_url']+'" target="_blank">NEXT</a>';
}


//++++++++++++++++//
// 右クリック禁止 //
//++++++++++++++++//
function ContextMenu(){

	// getElementsByTagName( '禁止するタグ要素' )
	var html_elements = document.getElementsByTagName( 'html' );
	for( var i in html_elements ){
		html_elements[i].oncontextmenu = function(){
			return false;
		}
	}
}



