function changeAction(key) 
{
	objForm = document.forms[0];
	objForm.action = key;
	objForm.submit();
}
function change() 
{
	objForm = document.forms[0];
	objForm.target="_top";
	objForm.submit();
}

function getDate(date)
{
	var datetime = new Date();
	var dates = datetime.getTime();
	var someDate = new Date( date ).getTime();
	var test = dates-someDate;
	var str = "";
	day = parseInt(Math.abs(test) / 1000 / 60 / 60 / 24 );
	if( day > 0 )
	{
		str += day + "日";
		test = parseInt(Math.abs(test) % 24);
		hour = parseInt(Math.abs(test) / 1000 / 60 / 60 );
		if(hour > 0)
		{
			str += hour + "時";
			test = parseInt(Math.abs(test) % 60);
			minutes = parseInt(Math.abs(test) / 1000 / 60 );
			if( minutes > 0 )
			{
				str += minutes + "分";
				test = parseInt(Math.abs(test) % 60);
				second = parseInt(Math.abs(test) / 1000);
				if( second > 0 )
				{
					str += second + "秒前　";
				}
				else
				{
					str += "前　";
				}
			}
			else
			{
				str += "前　";
			}
			
		}
		else
		{
			str += "前　";
		}
	}
	else
	{
		hour = parseInt(Math.abs(test) / 1000 / 60 / 60 );
		if(hour > 0)
		{
			str += hour + "時";
			test = parseInt(Math.abs(test) % 60);
			minutes = parseInt(Math.abs(test) / 1000 / 60 );
			if( minutes > 0 )
			{
				str += minutes + "分";
				test = parseInt(Math.abs(test) % 60);
				second = parseInt(Math.abs(test) / 1000);
				if( second > 0 )
				{
					str += second + "秒前　"　;
				}
				else
				{
					str += "前　";
				}
			}
			else
			{
				str += "前　";
			}
			
		}
		else
		{
			minutes = parseInt(Math.abs(test) / 1000 / 60 );
			if( minutes > 0 )
			{
				str += minutes + "分";
				test = parseInt(Math.abs(test) % 60);
				second = parseInt(Math.abs(test) / 1000);
				if( second > 0 )
				{
					str += second + "秒前　";
				}
				else
				{
					str += "前　";
				}
			}
			else
			{
				second = parseInt(Math.abs(test) / 1000);
				if( second > 0 )
				{
					str += second + "秒前　";
				}
				else
				{
					str += "1秒前　";
				}
			}
		}
	}
	return str;
}

function getDate1(date)
{
	var datetime = new Date();
	var dates = datetime.getTime();
	var someDate = new Date( date ).getTime();
	var test = dates-someDate;
	var str = "";
	day = parseInt(Math.abs(test) / 1000 / 60 / 60 / 24 );
	if( day > 0 )
	{
		str += day + "日";
		test = Math.abs(test) % (1000 * 60 * 60 * 24);
		hour = parseInt(Math.abs(test) / 1000 / 60 / 60 );
		if(hour > 0)
		{
			str += hour + "時";
			test = Math.abs(test) % (1000 * 60 * 60);
			minutes = parseInt(Math.abs(test) / 1000 / 60 );
			if( minutes > 0 )
			{
				str += minutes + "分";
				test = Math.abs(test) % (1000 * 60 );
				second = parseInt(Math.abs(test) / 1000);
				if( second > 0 )
				{
					str += second + "秒前";
				}
				else
				{
					str += "前";
				}
			}
			else
			{
				str += "前";
			}
			
		}
		else
		{
			str += "前";
		}
	}
	else
	{
		hour = parseInt(Math.abs(test) / 1000 / 60 / 60 );
		if(hour > 0)
		{
			str += hour + "時";
			test = Math.abs(test) % (1000 * 60 * 60);
			minutes = parseInt(Math.abs(test) / 1000 / 60 );
			if( minutes > 0 )
			{
				str += minutes + "分";
				test = Math.abs(test) % (1000 * 60 );
				second = parseInt(Math.abs(test) / 1000);
				if( second > 0 )
				{
					str += second + "秒前";
				}
				else
				{
					str += "前";
				}
			}
			else
			{
				str += "前";
			}
			
		}
		else
		{
			minutes = parseInt(Math.abs(test) / 1000 / 60 );
			if( minutes > 0 )
			{
				str += minutes + "分";
				test = Math.abs(test) % (1000 * 60 );
				second = parseInt(Math.abs(test) / 1000);
				if( second > 0 )
				{
					str += second + "秒前";
				}
				else
				{
					str += "前";
				}
			}
			else
			{
				second = parseInt(Math.abs(test) / 1000);
				if( second > 0 )
				{
					str += second + "秒前";
				}
				else
				{
					str += "1秒前";
				}
			}
		}
	}
	return str;
}

function getIndiesDate(time)
{
	var minutes = parseInt(Math.abs(time) % 60) ;
    var second= parseInt( Math.abs(time)  / 60);
    var hour = parseInt( Math.abs(time)  / ( 60 * 60) );
    var str="";
    if( hour > 0 )
    {
    	str += hour;
    	if( second > 0 )
    	{
    		str += ":" + second;
    		if( minutes > 0 )
    		{
    			str += ":" + minutes;
    		}
    		else
    		{
    			str += ":0";
    		}
    	}
    }
    else
    {
    	if( second > 0 )
    	{
    		str += "0:" + second;
    		alert(str);
    		if( minutes > 0 )
    		{
    			str += ":" + minutes;
    		}
    		else
    		{
    			str += ":0";
    		}
    	}
    	else
    	{
    		str += "0:0";
    			if( minutes > 0 )
    		{
    			str += ":" + minutes;
    		}
    		else
    		{
    			str += ":0";
    		}
    	}
    }
    return str;
}

function changeButton(str)
{
	document.getElementById('button_type').value = str;
	document.getElementById('play_time').value = getIndiesApp().GetMovieSeconds();
	objForm = document.forms[0].submit();
}

function getIndiesApp(appName) 
{
	if (navigator.appName.indexOf ("Microsoft") !=-1) 
	{
		return document.getElementById("indiesobject");
	}
	else 
	{
		return document.getElementById("indiesembed");
	}
}
function callApp()
{
	document.getElementById('play_time').value = getIndiesApp().GetMovieSeconds();
	document.forms[0].submit();
}

function showItem()
{
	var user_value = document.getElementById('user_value').value;
	var movie_value = document.getElementById('movie_value').value;
	if(user_value=="" || movie_value == "" )
	{
		return false;
	}
}
function changeFordetail(key)
{
	objForm = document.forms['changeform'];
	objForm.action = key;
	objForm.submit();
}

function cheangeSearch(id,key)
{
	document.getElementById(id).value = key;
	document.forms[name].submit();
}

