// JavaScript Document

function updatevip_checkr(s)
{
	if(s=='online'){		
		document.updateform1.action="updatevip.php?mode=online";
		document.updateform1.submit();
	}
	
	if(s=='offline'){
		document.updateform1.action="updatevip.php?mode=offline";
		document.updateform1.submit();
	}
	
	if(s=='offline_yh'){
		document.updateform1.action="updatevip.php?mode=offline_yh";
		document.updateform1.submit();
	}
	
	
}


function e_a_check(s)
{
	var lists=new Array('mp3','soft','game');
	for(var j=0;j<lists.length;j++){
		//alert(lists[j]);
		document.offlineform1["chk_"+lists[j]].checked=false;
		for(var i =0;i<document.offlineform1[lists[j]].length;i++)
		{
			 document.offlineform1[lists[j]][i].disabled=true;
			
		}
	}
	
	/*for(var i =0;i<document.offlineform1[s].length;i++)
	{
		 document.offlineform1[s][i].disabled=true;
		
	}*/
}

function a_e_check(s)
{
	var lists=new Array('mp3','soft','game');
	for(var j=0;j<lists.length;j++){
		//alert(lists[j]);
		document.offlineform1["chk_"+lists[j]].checked=true;
		for(var i =0;i<document.offlineform1[lists[j]].length;i++)
		{
			 document.offlineform1[lists[j]][i].disabled=false;
			
		}
	}
	
	/*
		for(var i =0;i<document.offlineform1[s].length;i++)
		{
			 document.offlineform1[s][i].disabled=false;
			
		}	
	*/
}

function init_j()
{	
	 e_a_check('mp3');
	 e_a_check('soft');
	 e_a_check('game');
}


function updatevip_submit(s)
{
	var str=new Array();
	var j=0;
	var mp3tf=false;
	var softtf=false;
	var gametf=false;
	if(document.offlineform1.chk_mp3.checked)
	{		
		j++;//alert("mp3"); 		
		for(var i=0;i<document.offlineform1.mp3.length;i++)
		{
			if(document.offlineform1.mp3[i].checked)
			{
				str[0]=document.offlineform1.mp3[i].value;
				mp3tf=true;
			}
		}
		
		if(mp3tf==false)
		{
			alert("期間を選らんで下さい");	
			return false;			
		}
	}
	else
	{
		
		str[0]=0;	
	}
	
	if(document.offlineform1.chk_soft.checked)
	{
		j++;//alert("soft"); 
		for(var i=0;i<document.offlineform1.soft.length;i++)
		{
			if(document.offlineform1.soft[i].checked)
			{
				str[1]=document.offlineform1.soft[i].value;
				softtf=true;
				}			
		}
		
		if(softtf==false)
		{
			alert("期間を選らんで下さい");
			return false;
		}
	}
	else
	{
		
		str[1]=0;	
	}
	
	if(document.offlineform1.chk_game.checked)
	{
		j++;//alert("game"); 
		for(var i=0;i<document.offlineform1.game.length;i++)
		{
			if(document.offlineform1.game[i].checked)
			{
				str[2]=document.offlineform1.game[i].value;
				gametf=true;
				}			
			}
		if(gametf==false)
		{
			alert("期間を選らんで下さい");
			return false;
			}
	}	
	else
	{
		
		str[2]=0;	
	}
		

	
	if(j==0)
	{
		alert("項目一つを選らんで下さい");
		return false;		
	}

	document.offlineform1.update_d.value=str;
	document.offlineform1.action="updatevip.php?mode="+s;
	document.offlineform1.submit();
}

function updatevip_ok(s)
{
	document.form2.action="updatevip.php?ok=in&mode="+s;
	document.form2.submit();	
}

function manageSet(actionX,value)
{
	var total=document.all[actionX].length;
	for(var i=0;i<total;i++)
	{
		if(document.all[actionX][i].value==value)
		{
			document.all[actionX][i].selected=true;
			break;
			}
		}
}


function Menu1(var1,var2,act1)
{
	for(var i=0;i<var1.length;i++)
	{
		document.all[act1].options.add(new Option(var1[i],var2[i]));
	}
}

function Change_s(sid,var1,var2,var3,act1,act2)
{
		
		for(var j=document.all[act1].length-1;j>=0;j--)
		{
			document.all[act1].options.remove(j);
		}
		
		for(var j=0;j<document.all[act2].length;j++)
		{
			if(document.all[act2].options[j].value==sid)
			{
				document.all[act2].options[j].checked=true;
				break;			
			}
		}
		
	
		for(var j=0;j<var3.length;j++)
		{
			if(var3[j]==sid)
			{
				document.all[act1].options.add(new Option(var1[j],var2[j]));
			}		
		}
}

function f_pop(url,w,h)
{
	window.open(url,'','width='+w+',height='+h+',top=0, left=0, toolbar=no, menubar=no, scrollbars=no,resizable=no,location=no, status=no');	
}



function select_checkbox(act1,var1)
{
	//array_select
	for(var j=0;j<document.all[act1].length;j++)
	{
		for(var i=0;i<var1.length;i++)
		{					
			if(document.all[act1][j].value==var1[i])
			{
				document.all[act1][j].checked=true;
			}
		}		
	}
}


function selectSingle(act1,var1){
	//select_single
	for(var j=0;j<document.all[act1].length;j++){						
		if(document.all[act1][j].value==var1){
			document.all[act1][j].checked=true;
		}			
	}
}

function high(which2){
theobject=which2
highlighting=setInterval("highlightit(theobject)",40)
}
function low(which2){
clearInterval(highlighting)
which2.filters.alpha.opacity=70
}
function highlightit(cur2){
if (cur2.filters.alpha.opacity<100)
cur2.filters.alpha.opacity+=5
else if (window.highlighting)
clearInterval(highlighting)
}


function largess(s)
{
	var lists=new Array('mp3','soft','game')
	for(var i=0;i<lists.length;i++)
	{
		document.offlineform1[lists[i]][s-1].checked=true;
	}
	
}


function getHeight()
{
		var s=screen.height;
		var tb=document.getElementById("s1");
		tb.height=s-300;

}

function confirmLink(theLink, theSqlQuery)
{
    // Confirmation is not required in the configuration file
    // or browser is Opera (crappy js implementation)
	/*
    if (confirmMsg == '' || typeof(window.opera) != 'undefined') {
        return true;
    }*/

    var is_confirmed = confirm('Delete '+theSqlQuery+" ?");
    if (is_confirmed) {
        theLink.href += '&is_js_confirmed=1';
    }

    return is_confirmed;
}

///////////////////////////////////////////////////////////////////////////////////



function showimage(var1,act1,act2){
		document.all[act1].src=var1+document.all[act2].options[document.all[act2].selectedIndex].value+".gif";
		}

