var HOST = 'www.saiyo-usen.com';

function cacheMenu(p){
	var d=document;
	var a = new Array('menu_tryout.gif','menu_system.gif','menu_work.gif','menu_company.gif');
	if(d.images){
		if(!d.p) d.p=new Array();
		for(i=0; i<a.length; i++){
			(new Image()).src = p+a[i];
		}
	}
}

// Copyright (c) 1996-1997 Athenia Associates.
// http://www.webreference.com/js/
// License is granted if and only if this entire
// copyright notice is included. By Tomer Shiran.

function setCookie (name, value, expires, path, domain, secure) {
    var curCookie = name + "=" + escape(value) + ((expires) ? "; expires=" + expires.toGMTString() : "") + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + ((secure) ? "; secure" : "");
    document.cookie = curCookie;
}

function getCookie (name) {
    var prefix = name + '=';
    var c = document.cookie;
    var nullstring = '';
    var cookieStartIndex = c.indexOf(prefix);
    if (cookieStartIndex == -1)
        return nullstring;
    var cookieEndIndex = c.indexOf(";", cookieStartIndex + prefix.length);
    if (cookieEndIndex == -1)
        cookieEndIndex = c.length;
    return unescape(c.substring(cookieStartIndex + prefix.length, cookieEndIndex));
}

function deleteCookie (name, path, domain) {
    if (getCookie(name))
        document.cookie = name + "=" + ((path) ? "; path=" + path : "") + ((domain) ? "; domain=" + domain : "") + "; expires=Thu, 01-Jan-70 00:00:01 GMT";
}

function fixDate (date) {
    var base = new Date(0);
    var skew = base.getTime();
    if (skew > 0)
        date.setTime(date.getTime() - skew);
}

function rememberMe (f) {
    var now = new Date();
    fixDate(now);
    now.setTime(now.getTime() + 365 * 24 * 60 * 60 * 1000);
    setCookie('mtcmtauth', f.author.value, now, '', HOST, '');
    setCookie('mtcmtmail', f.email.value, now, '', HOST, '');
    setCookie('mtcmthome', f.url.value, now, '', HOST, '');
}

function forgetMe (f) {
    deleteCookie('mtcmtmail', '', HOST);
    deleteCookie('mtcmthome', '', HOST);
    deleteCookie('mtcmtauth', '', HOST);
    f.email.value = '';
    f.author.value = '';
    f.url.value = '';
}
function openWindow (u,n,w,h) {
	window.open(u, n, 'resizable=no, scrollbars=yes, width='+w+', height='+h);
}
function openWindowLarge (u,n) {
	window.open(u, n, 'fullscreen=yes resizable=no, scrollbars=no');
}
var mac = navigator.platform.indexOf("Mac")>=0; // MAC?
var ie = navigator.appVersion.indexOf("MSIE")>=0; // IE?
var ms = navigator.appVersion.indexOf("MSIE");
var ie4 = (ms>0) && (parseInt(navigator.appVersion.substring(ms+5, ms+6)) >= 4);
var nesc = navigator.appName.lastIndexOf("Netscape"); //一致した位置(0)を返す
var nesc4 = (nesc >= 0) && (parseInt(navigator.appVersion.substring(0,2)) >= 4);
focusflg = false; // focus機能フラグ
function openFullscreen(u,n){
	if(mac){
		if(ie){ // MAC IE
			var hoseix = -12; var hoseiy = -48;
		}else{ // MAC NN
			var hoseix = -12; var hoseiy = -48;
		}
		var w = window.screen.width + hoseix; // 
		var h = window.screen.height + hoseiy; // 

   	newwindow = window.open(u,n,"status=no,menubar=no,scrollbars=no,width=" + w + ",height=" + h);
		newwindow.moveTo(0,0);
		
	}else if (nesc4){ // WIN NN
		var hoseix = -6; var hoseiy = 0;
		var w = window.screen.width + hoseix; // 
		var h = window.screen.height + hoseiy; // 

	   	newwindow = window.open(u,n,"titlebar=no,fullscreen=yes,width=" + w + ",height=" + h);
		newwindow.moveTo(0,0);
		newwindow.focus();
	}else if (ie4){
		window.open(u,"screen","fullscreen=yes");
	}else{
		location.href=u;

	}
}
function openWindowMessage (u,n) {
	window.open(u, n, 'resizable=no, scrollbars=no, width=800, height=795');
}
function openWindowZadankai (u,n) {
	window.open(u, n, 'resizable=no, scrollbars=no, width=900, height=740');
}
function openWindowRanking (u,n) {
	window.open(u, n, 'resizable=no, scrollbars=yes, width=720, height=750');
}
function closeWindow(){
  window.close();
}
function closeWindowMove(u){
	window.opener.location=u;
	window.opener.focus();
//  window.close();
}
function resizeWindow() {
	window.resizeTo(910,650);
}

function pjump(leftsp,topsp){
	self.scroll(leftsp,topsp);
	return false;
}