
var flag = 0;
var dir;
var tTimer;
var LoadFinish = false;

var agent = navigator.userAgent.toLowerCase();
var w3c = document.getElementById;
var gecko = agent.indexOf("gecko") != -1;
var opera = agent.indexOf("opera",0) != -1;
var safari = agent.indexOf("safari") != -1;
var isPc = (navigator.userAgent.indexOf("Windows") != -1);
var isMac = (navigator.userAgent.indexOf("Mac") != -1);
var isNS = (navigator.appName == "Netscape");
var isNS4 = (isNS && (navigator.userAgent.indexOf("Gecko") == -1));
var isNS6 = (navigator.userAgent.indexOf("Gecko") != -1);
var isIE = ((navigator.userAgent.indexOf("MSIE") != -1) && (navigator.userAgent.indexOf("Opera") == -1));
var isIEPc = ((navigator.userAgent.indexOf("MSIE") != -1) && isPc && (navigator.userAgent.indexOf("Opera") == -1));
var isIEPc5 = ((navigator.userAgent.indexOf("MSIE 5.0") != -1) && isPc && (navigator.userAgent.indexOf("Opera") == -1));
var isIEPc55 = ((navigator.userAgent.indexOf("MSIE 5.5") != -1) && isPc && (navigator.userAgent.indexOf("Opera") == -1));
var isIEPc6 = ((navigator.userAgent.indexOf("MSIE 6.") != -1) && isPc && (navigator.userAgent.indexOf("Opera") == -1));
var isIEMac = ((navigator.userAgent.indexOf("MSIE") != -1) && isMac && (navigator.userAgent.indexOf("Opera") == -1));
var version = parseInt(navigator.appVersion);
var lP = location.pathname;

//Toppagesearchのsubmit

function searchSubmit(){
	var g = window.document.searchform.carrier.value;
	// alert(g);
	
	
	url = 'https://recochoku.jp/search/Srch' + g;
	wname = 'popup';
	win_set = 'width=650';
	win_set += ',height=560';
	win_set += ',resizable=yes';
	win_set += ',toolbar=yes'
	win_set += ',scrollbars=yes'
	win_set += ',fullscreen=no';
	
	swin = window.open(url,wname,win_set);
	swin.focus();
}

// Top新着切り替え
function changeNew(prove){
	if (prove == 0){
			document.getElementById("new1-Container").style.display="block";
			document.getElementById("new2-Container").style.display="none";
	} else if (prove == 1){
			document.getElementById("new1-Container").style.display="none";
			document.getElementById("new2-Container").style.display="block";
			if(gecko) {window.resizeBy(0,1);window.resizeBy(0,-1);}
	}
}

if(document.getElementById("update")){
document.getElementById("update").style.top="300px";
document.getElementById("update").style.left="200px";
}

// PickUpタイトル渡し
function sendPlayback(t){


	//document.sendtitleform.action = '/form/playback_form.php';

	//alert(document.sendtitleform.action);

	ttl = encodeURL(t);
	// alert(ttl);
	url = '/form/playback_form.php?pickuptitle=' + ttl;
	wname = 'playback';
	win_set = 'width=600';
	win_set += ',height=560';
	win_set += ',resizable=yes';
	win_set += ',menubar=yes';
	win_set += ',status=yes';
	win_set += ',toolbar=no'
	win_set += ',scrollbars=yes'
	win_set += ',fullscreen=no';
	
	// document.sendtitleform.submit();
	swin = window.open(url,wname,win_set);
	swin.focus();
}


function roll(imageName, imageState) {
	if (loaded == 1 && imageState != '') {
		tabOn = eval(imageName+"_"+imageState+".src");
		document[imageName].src = tabOn;
	}else{
		return false;
	}
}

function roll3(imageName, imageState, elementName) {
	if (loaded == 1 && imageState != '') {
		tabOn = eval(imageName+"_"+imageState+".src");
		document[elementName].src = tabOn;
	}else{
		return false;
	}
}

function rollRank(id,url) {
	if (document.getElementById) {
		frames["if_"+id].location.href=url;
	}else{
		document.layers["lay_"+id].src=url;
	}
}

var loaded = 0;

	gn01_off = new Image();gn01_off.src ='/images/common/gn_1_1.gif';
	gn01_on = new Image();gn01_on.src ='/images/common/gn_1_2.gif';
	gn02_off = new Image();gn02_off.src ='/images/common/gn_2_1.gif';
	gn02_on = new Image();gn02_on.src ='/images/common/gn_2_2.gif';
	gn03_off = new Image();gn03_off.src ='/images/common/gn_3_1.gif';
	gn03_on = new Image();gn03_on.src ='/images/common/gn_3_2.gif';
	gn04_off = new Image();gn04_off.src ='/images/common/gn_4_1.gif';
	gn04_on = new Image();gn04_on.src ='/images/common/gn_4_2.gif';
	gn05_off = new Image();gn05_off.src ='/images/common/gn_5_1.gif';
	gn05_on = new Image();gn05_on.src ='/images/common/gn_5_2.gif';

	footer01_off = new Image();footer01_off.src ='/images/common/footer_1_1.gif';
	footer01_on = new Image();footer01_on.src ='/images/common/footer_1_2.gif';
	footer02_off = new Image();footer02_off.src ='/images/common/footer_2_1.gif';
	footer02_on = new Image();footer02_on.src ='/images/common/footer_2_2.gif';
	footer03_off = new Image();footer03_off.src ='/images/common/footer_3_1.gif';
	footer03_on = new Image();footer03_on.src ='/images/common/footer_3_2.gif';

// 検索フォーム用ボタン040616追加
	btn_search01_off = new Image();btn_search01_off.src ='/images/search/search_panel_left_btn_1.gif';
	btn_search01_on = new Image();btn_search01_on.src ='/images/search/search_panel_left_btn_2.gif';
	btn_search03_off = new Image();btn_search03_off.src ='/images/search/search_panel_bottom_btn_1.gif';
	btn_search03_on = new Image();btn_search03_on.src ='/images/search/search_panel_bottom_btn_2.gif';
	btn_newaccess_off = new Image();btn_newaccess_off.src ='/images/search/download_new_access_1.gif';
	btn_newaccess_on = new Image();btn_newaccess_on.src ='/images/search/download_new_access_2.gif';


loaded = 1;

function openWin(url,wname,w,h,resizable,toolbar,scrollbars){
		
		if (h >= (screen.height-30)){
			h = screen.height-100;
			w += 18;
			scrollbars = 1;
		}

		if (w >= (screen.width-30)){
			w = screen.width-100;
			h += 20;
			scrollbars = 1;
		}
		
		win_set = 'width=' + w;
		win_set += ',height=' + h;
		win_set += ',resizable=' + resizable;
		win_set += ',toolbar=' + toolbar;
		win_set += ',scrollbars=' + scrollbars;
		win_set += ',fullscreen=no';
		
		swin = window.open(url,wname,win_set);
		swin.focus();
}

function openWin3(url,name,h){
//if(isNS6){
//url = unescape(url);
//}
	wh = (h <= (screen.height-100))? h : screen.height-250;
	win_set = 'width=650,toolbar=no,resizable=yes,menubar=no,status=yes,scrollbars=yes';
	win_set += ',height=' + wh;
	swin = window.open(url,name,win_set);
	swin.focus();
}

function popWin(url,name,h){
//if(isNS6){
//url = unescape(url);
//}
	wh = (h <= (screen.height-100))? h : screen.height-250;
	win_set = 'width=560,toolbar=no,resizable=yes,menubar=no,status=yes,scrollbars=yes';
	win_set += ',height=' + wh;
	swin = window.open(url,name,win_set);
	swin.focus();
}

function popWin2(url,name,h){
//	if(isNS6){
//	url = unescape(url);
//	}

	win_set = 'width=320,height=275,toolbar=no,resizable=no,menubar=no,status=no,scrollbars=no';

	swin = window.open(url,name,win_set);
	swin.focus();
}

function popWin3(url,name,h){
//if(isNS6){
//url = unescape(url);
//}
	wh = (h <= (screen.height-100))? h : screen.height-250;
	win_set = 'width=650,toolbar=no,resizable=yes,menubar=no,status=yes,scrollbars=yes';
	win_set += ',height=' + wh;
	swin = window.open(url,name,win_set);
	swin.focus();
}

//検索キャリア別プルダウンメニュー
function switchMenu(X) {
	if (X == 1) {
		window.name="";
		document.forms["searchform"].elements["type"].options.length = 0;
		document.forms["searchform"].elements["type"].options[0] = new Option('着うた');
		document.forms["searchform"].elements["type"].options[0].value = 0;
		document.forms["searchform"].elements["type"].options[1] = new Option('着うたフル');
		document.forms["searchform"].elements["type"].options[1].value = 3;
		document.forms["searchform"].elements["type"].options[2] = new Option('着ムービー');
		document.forms["searchform"].elements["type"].options[2].value = 1;
		document.forms["searchform"].elements["type"].options[3] = new Option('着信メロディ');
		document.forms["searchform"].elements["type"].options[3].value = 2;
		document.forms["searchform"].elements["type"].options[4] = new Option('待ちうた');
		document.forms["searchform"].elements["type"].options[4].value = 4;
	} else if(X == 2) {
		window.name="lmdoco";
		document.forms["searchform"].elements["type"].options.length = 0;
		document.forms["searchform"].elements["type"].options[0] = new Option('着うた');
		document.forms["searchform"].elements["type"].options[0].value = 0;
		document.forms["searchform"].elements["type"].options[1] = new Option('着モーション');
		document.forms["searchform"].elements["type"].options[1].value = 1;
		document.forms["searchform"].elements["type"].options[2] = new Option('着信メロディ');
		document.forms["searchform"].elements["type"].options[2].value = 2;
		document.forms["searchform"].elements["type"].options[3] = new Option('メロディコール');
		document.forms["searchform"].elements["type"].options[3].value = 4;
	} else if(X == 3) {
		window.name="lmvoda";
		document.forms["searchform"].elements["type"].options.length = 0;
		document.forms["searchform"].elements["type"].options[0] = new Option('着うた');
		document.forms["searchform"].elements["type"].options[0].value = 0;
		document.forms["searchform"].elements["type"].options[1] = new Option('着うたフル');
		document.forms["searchform"].elements["type"].options[1].value = 3;
		document.forms["searchform"].elements["type"].options[2] = new Option('着ビデオ');
		document.forms["searchform"].elements["type"].options[2].value = 1;
		document.forms["searchform"].elements["type"].options[3] = new Option('着信メロディ');
		document.forms["searchform"].elements["type"].options[3].value = 2;
	}
	document.forms["searchform"].type.value = 0; // 切替え後は初期値に戻す
}

function setRadio(n){
	document.searchform.elements[n].checked=true;
	x = n + 1;
	switchMenu(x);
}

try{
	if(window.name == "lmdoco"){
		inputDefault = '<select name="type" class="pulldown">';
		inputDefault += '<option value="0" selected>着うた</option>';
		inputDefault += '<option value="1">着モーション</option>';
		inputDefault += '<option value="2">着信メロディ</option>';
		inputDefault += '<option value="4">メロディコール</option>';
		inputDefault += '</select>';
	} else if(window.name == "lmvoda"){
		inputDefault = '<select name="type" class="pulldown">';
		inputDefault += '<option value="0" selected>着うた</option>';
		inputDefault += '<option value="3">着うたフル</option>';
		inputDefault += '<option value="1">着ビデオ</option>';
		inputDefault += '<option value="2">着信メロディ</option>';
		inputDefault += '</select>';
	} else {
		inputDefault = '<select name="type" class="pulldown">';
		inputDefault += '<option value="0" selected>着うた</option>';
		inputDefault += '<option value="3">着うたフル</option>';
		inputDefault += '<option value="1">着ムービー</option>';
		inputDefault += '<option value="2">着信メロディ</option>';
		inputDefault += '<option value="4">待ちうた</option>';
		inputDefault += '</select>';
	}
}
catch(e){}


function encodeURL(str){
    var s0, i, s, u;
    s0 = "";

    for (i = 0; i < str.length; i++){
        s = str.charAt(i);
        u = str.charCodeAt(i);
        if (s == " "){s0 += "+";}
        else {
            if ( u == 0x2a || u == 0x2d || u == 0x2e || u == 0x5f || ((u >= 0x30) && (u <= 0x39)) || ((u >= 0x41) && (u <= 0x5a)) || ((u >= 0x61) && (u <= 0x7a))){
                s0 = s0 + s;
            }else{
                if ((u >= 0x0) && (u <= 0x7f)){
                    s = "0"+u.toString(16);
                    s0 += "%"+ s.substr(s.length-2);
                }else if (u > 0x1fffff){
                    s0 += "%" + (oxf0 + ((u & 0x1c0000) >> 18)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0x3f000) >> 12)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }else if (u > 0x7ff){
                    s0 += "%" + (0xe0 + ((u & 0xf000) >> 12)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }else{
                    s0 += "%" + (0xc0 + ((u & 0x7c0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }
            }
        }
    }
    return s0;

}