// JavaScript Document
/*
//ヘッダー部分 検索窓用スクリプト
//2006/09/01

*/
var FirstValue = " ";
var usrInputValue = FirstValue;

function getPage(pageURL) {
	usrInputValue = document.getElementById("hs").value;
	xmlhttp = createXMLHttp();
	if (xmlhttp)
	{
		xmlhttp.onreadystatechange = setPageData;
		xmlhttp.open('GET', pageURL);
		xmlhttp.send(null);
	}else{
		alert("XMLHttpRequest失敗");
	}
}
function setPageData()
{
	if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
	{
		document.getElementById("hsDisp").innerHTML = xmlhttp.responseText;
		setFirstValue("hs", usrInputValue);
	}
}
// XMLHttpsオブジェクト作成
function createXMLHttp()
{
	try {
		return new ActiveXObject ("Microsoft.XMLHTTP");
	}catch(e){
		try {
			return new XMLHttpRequest();
		}catch(e) {
			return null;
		}
	}
	return null;
}


function setFirstValue(ElementName,text) {
var sWin=document.getElementById(ElementName);
sWin.value=" 検索 ";

if(document.getElementById&&(navigator.userAgent.match(/Win/)||navigator.userAgent.match(/Firefox/)||navigator.userAgent.match(/Safari/))){
	if(FirstValue != text) sWin.style.color="#000";
	sWin.value= text;
}
sWin.onfocus=function(){
	if(FirstValue == text){
		sWin.value="";sWin.style.color="#000";
	}
};	
}

function dsongSearch()
{
	if (document.dsong.tp[0].checked)
		document.dsong.action = "http://www.oricondd.com/search/index.php";
	else if (document.dsong.tp[1].checked)
		document.dsong.action = "http://www.oricondd.com/atrac/search/index.php";
		else
			document.dsong.action = "http://www.oricondd.com/search/search_index.php";
}

function tupsongSearch()
{
	if (document.tupsong.search_type.value == "tieup_pro")
		document.tupsong.tieup_pro.value = document.tupsong.search_string.value;
	else if (document.tupsong.search_type.value == "tieup_com")
		document.tupsong.tieup_com.value = document.tupsong.search_string.value;
		else
			return 0;
}

function msongSearch()
{
	if (document.msong.search_type.value == ".artist" )
		document.msong.artist.value = document.msong.search_string.value;
	else if (document.msong.search_type.value == ".song")
		document.msong.song.value = document.msong.search_string.value;
		else
			return 0;
}

function chartSearch()
{
	if (document.chart.search_type[0].checked)
		document.chart.kbn.value = "js";
	else if (document.chart.search_type[1].checked)
		document.chart.kbn.value = "ja";
		else
			return 0;
}

function ticketSearch()
{
	alert(escape(document.ticket.search_string.value));
	document.ticket.ps12.value = encodeURIComponent(document.ticket.search_string.value);
	alert(document.ticket.ps12.value);
}

function SelectCDListTab(SelectValue){
	var num = SelectValue.options[SelectValue.selectedIndex].value;
	var txt = document.getElementById("hs_cd_search_box"+num).innerHTML;
	document.getElementById("hs_cd_search_box").innerHTML = txt;
}


