/*
By Ike
*/
var episode_window = null;
var glossary_window = null;
var link_window = null;
var justhome_window = null;
var elqhome_window = null;
var test_window = null;
var csv_window = null;
var course_map = null;
function WindowOpenUpSide(windowname, url, title) {
var window_obj = eval(windowname);
if( window_obj != null && !window_obj.closed ) {
window_obj.location.replace( url );
window_obj.focus();
} else {
window_obj = window.open( url,title,"toolbar=no,location=no,directories=no,status=no,resizable=yes,scrollbars=yes,menubar=no");
window_obj.focus();
}
return false;
}
/*
end
*/
function onOperation( index ) {
document.operation.listkind.value = index;
return true;
}
function browserCheck( old_browser ) {
if( navigator.appName.charAt( 0 ) == "N" ) {
if( parseInt( navigator.appVersion.charAt( 0 ) ) >= 5 ) {
return 6;
} else {
if( navigator.platform.indexOf( "Win" ) != -1 ) {
alert( old_browser );
/* netscape.security.PrivilegeManager.enablePrivilege( "UniversalBrowserWrite" ); */
window.setResizable( false );
}
return 4;
}
}
return 0;
}
function checkForEnter() {
return ( event.keyCode == 13 );
}
function submitForm( submit_form ) {
submit_form.submit();
return false;
}
function onLogout( info_input,url ) {
if( confirm( info_input.value ) ) {
return GoTo( url );
}
return false;
}
function needToReload( page_name ) {
if( getNeedToReload( page_name ) ) {
setNeedToReload( page_name,false );
window.location.reload( true );
} else {
setNeedToReload( page_name,true );
}
}
function removeReloadCookie( page_name ) {
var last_year = new Date();
last_year.setFullYear( last_year.getFullYear()-1 );
document.cookie = page_name+"=;/ichitaro/Regist;expires="+last_year.toGMTString()+";";
}
function getNeedToReload( page_name ) {
var cookies = document.cookie;
if( cookies != "" ) {
var start = cookies.indexOf( page_name );
if( start >= 0 ) {
cookies = cookies.substring( start );
start = cookies.indexOf( '=' )+1;
end = cookies.indexOf( ';' );
return ( cookies.substring( start,end ) == "true" );
}
}
return false;
}
function setNeedToReload( page_name,reload_flag ) {
var cookies = document.cookie;
var cookie = "";
if( cookies != "" && cookies.indexOf( page_name ) >= 0 ) {
removeReloadCookie( page_name );
}
document.cookie = page_name+'='+reload_flag+';';
}
function loseFocus( form_input ) {
form_input.blur();
return false;
}
function session_expired( prompt,url ) {
alert( prompt );
top.location.replace( url );
window.close();
}
function session_expired( prompt,url ) {
alert( prompt );
top.location.replace( url );
window.close();
}
function onClose() {
window.close();
return false;
}
function startTimer( session_interval,replace_url,expire_prompt,current_time,tail ) {
window.setTimeout( "CheckSessionTermination( '"+replace_url+"', '"+ToUniCode( expire_prompt )+"','"+ToUniCode( current_time )+"','"+ToUniCode( tail )+"' );",(session_interval-60)*1000 );
return false;
}
function CheckSessionTermination( replace_url,expire_prompt_code,current_time_code,tail_code ) {
if( SessionTermination( expire_prompt_code,current_time_code,tail_code ) ) {
top.location.reload();
} else {
top.location.replace( replace_url );
}
}
function SessionTermination( expire_prompt_code,current_time_code,tail_code ) {
var now = new Date((new Date()).getTime() );
var mins = now.getMinutes();
mins = (mins < 10) ? "0"+mins : mins;
var hours = now.getHours();
hours = (hours < 10) ? "0"+hours : hours;
var expire_prompt = eval( "String.fromCharCode( "+expire_prompt_code+" ) " )+"\n"+eval( "String.fromCharCode( "+current_time_code+" ) " )+hours+":"+mins+eval( "String.fromCharCode( "+tail_code+" ) " );
return window.confirm( expire_prompt );
}
function putInUrl( url,param,value ) {
var index = -1;
var length = param.length;
var url_1 = "";
var url_2 = url;
param += "=";
while( ( index = url_2.indexOf( param ) ) >= 0 ) {
if( ( url_2.charAt( index-1 ) == '&' ) || ( url_2.charAt( index-1 ) == '?' ) ) {
url_1 += url_2.substring( 0,index );
index = url_2.indexOf( "&" );
if( index < 0 ) {
url_2 = "";
break;
} else {
url_2 = url_2.substring( index+1 );
}
} else {
index = url_2.indexOf( "&" );
if( index >= 0 ) {
url_1 += url_2.substring( 0,index+1 );
url_2 = url_2.substring( index+1 );
} else {
url_1 += url_2;
url_2 = "";
}
}
}
var last_char = url_1.charAt( url_1.length-1 );
var first_char = url_2.charAt( 0 );
if( ( last_char == '?' || last_char == '&' ) && ( first_char == '&' ) ) {
url_1 = url_1.substring( 0,url_1.length-1 );
}
url_1 += url_2;
value = urlFormat( value.toString() );
return ( url_1+connector( url_1 )+param+value );
}
function connector( url ) {
if( url.match( /\?/ ) != null ) {
return "&";
} else {
return "?";
}
}
/* sucks */
function urlFormat( url ) {
return url.replace( /\&/g,"SOSITE" ).replace( / /g,"YOHAKU" ).replace( /\n/g,"JIGYOU" ).replace( /\r/g,"" );
}
function decodeToHTML( url ) {
document.write( url.replace( /SOSITE/g,"\&" ).replace( /YOHAKU/g," " ).replace( /JIGYOU/g,"
" ) );
}
function decodeToString( url ) {
return ( url.replace( /SOSITE/g,"\&" ).replace( /YOHAKU/g," " ).replace( /JIGYOU/g,"\n" ) );
}
function ToUniCode( str ) {
var code = "";
var i;
for( i=0;i