function df(){
	my_ua = get_ua();
	dval = document.domain;
/*
	var zvl = 100;
	var dir;
	var url = location.href;
	var uval = 'http://' + dval;
	if(url.match(/mighty2/)) uval += (url.match(/\.com/) ? '/usen' : '') + '/usen_com/www';
	var RegUrl = url.match(/\//g);
	
	if (RegExp.leftContext == uval) {
		dir = '0';
	}
	else if (url.match(/\/company/)) {
		dir = '1';
	}
	else if (url.match(/\/business/)) {
		dir = '2';
	}
	else if (url.match(/\/ir/)) {
		dir = '3';
	}
	else if (url.match(/\/news/)) {
		dir = '4';
	}
	else if (url.match(/\/recruit/)) {
		dir = '5';
	}
	//for safari & mac_ie
	else if ((my_ua == 'mac_sf' || my_ua == 'mac_ie') && (uval == 'http://www.usen.com' || uval == 'http://ns1.mighty2.com/usen/usen_com/www' || uval == 'http://usen.mighty2.net/usen_com/www')) {
		dir = '0';
	}
	
	if (document.getElementById) {
		if (dir == '0') {
			document.getElementById('nav_home').style.background = 'url(images/global_nav.gif) -0px -20px no-repeat';
		}
		else if (dir == '1') {
			document.getElementById('nav_company').style.background = 'url(../images/global_nav.gif) -88px -20px no-repeat';
		}
		else if (dir == '2') {
			document.getElementById('nav_domain').style.background = 'url(../images/global_nav.gif) -188px -20px no-repeat';
		}
		else if (dir == '3') {
			document.getElementById('nav_ir').style.background = 'url(../images/global_nav.gif) -288px -20px no-repeat';
		}
		else if (dir == '4') {
			document.getElementById('nav_news').style.background = 'url(../images/global_nav.gif) -378px -20px no-repeat';
		}
		else if (dir == '5') {
			document.getElementById('nav_recruit').style.background = 'url(../images/global_nav.gif) -516px -20px no-repeat';
		}
		fixedLayer('header_plus');
		document.getElementById('header_plus').style.zIndex = zvl;
		if (my_ua.match(/ns$/) && url.match(/mailmag/)) document.getElementById('nav').style.top = '71px';
	}
	else if (document.all) {
		if (dir == '0') {
			document.all('nav_home').style.background = 'url(images/global_nav.gif) -0px -20px no-repeat';
		}
		else if (dir == '1') {
			document.all('nav_company').style.background = 'url(../images/global_nav.gif) -88px -20px no-repeat';
		}
		else if (dir == '2') {
			document.all('nav_domain').style.background = 'url(../images/global_nav.gif) -188px -20px no-repeat';
		}
		else if (dir == '3') {
			document.all('nav_ir').style.background = 'url(../images/global_nav.gif) -288px -20px no-repeat';
		}
		else if (dir == '4') {
			document.all('nav_news').style.background = 'url(../images/global_nav.gif) -378px -20px no-repeat';
		}
		else if (dir == '5') {
			document.all('nav_recruit').style.background = 'url(../images/global_nav.gif) -516px -20px no-repeat';
		}
		fixedLayer('header_plus');
		document.all('header_plus').style.zIndex = zvl;
	}
	else if (document.layers) {
		if (dir == '0') {
			document.layers['nav_home'].style.background = 'url(images/global_nav.gif) -0px -20px no-repeat';
		}
		else if (dir == '1') {
			document.layers['nav_company'].style.background = 'url(../images/global_nav.gif) -88px -20px no-repeat';
		}
		else if (dir == '2') {
			document.layers['nav_domain'].style.background = 'url(../images/global_nav.gif) -188px -20px no-repeat';
		}
		else if (dir == '3') {
			document.layers['nav_ir'].style.background = 'url(../images/global_nav.gif) -288px -20px no-repeat';
		}
		else if (dir == '4') {
			document.layers['nav_news'].style.background = 'url(../images/global_nav.gif) -378px -20px no-repeat';
		}
		else if (dir == '5') {
			document.layers['nav_recruit'].style.background = 'url(../images/global_nav.gif) -516px -20px no-repeat';
		}
		fixedLayer('header_plus');
		document.layers['header_plus'].zIndex = zvl;
	}
*/
}

function fixedLayer(layName){
	if (!window.fixedLayer[layName]) {
		this.ie    = !!document.all;
		this.n4    = !!document.layers;
		this.w3c   = !!document.getElementById;
		this.ua    = navigator.userAgent;
		this.mac45 = ua.indexOf('MSIE 4.5; Mac_PowerPC') != -1;
		this.mac5  = ua.indexOf('MSIE5.0;Mac_PowerPC')   != -1;
		this.macie = ua.indexOf('Mac_PowerPC') != -1 && ie;
		this.moz   = ua.indexOf('Gecko') != -1;
		this.opr   = !!window.opera;
		if (this.ie && !(this.mac45)) {
			window.onresize = df;
		}
		if (this.n4) {
			window.onresize = function(){ location.reload(); return false;};
			window.fixedLayer[layName] = true;
		}
	}
	
	var px = 0;
	var nvx = 0;
	var x = 610;
	if (my_ua == 'win_ns') {
		nvx = 0;
	}
	else if (my_ua == 'win_gk') {
		nvx = 0;
	}
	else if (my_ua == 'win_op') {
		nvx = 0;
	}
	else if (my_ua == 'win_ie') {
		nvx = 0;
	}
	else if (my_ua == 'mac_sf') {
		nvx = -10;
	}
	else if (my_ua == 'mac_ns') {
		nvx = 0;
	}
	else if (my_ua == 'mac_gk') {
		nvx = 0;
	}
	else if (my_ua == 'mac_op') {
		nvx = -10;
	}
	else if (my_ua == 'mac_ie') {
		nvx = 0;
	}
	
	if (document.getElementById) {
		px = document.getElementById('wrapper').offsetLeft;
		document.getElementById(layName).style.left = x + nvx + px + 'px';
	}
	else if (document.all) {
		px = document.all('wrapper').offsetLeft;
		document.all(layName).style.pixelLeft = x + nvx + px + 'px';
	}
	else if (document.layers) {
		var tm = document.layers['header_plus'].top;
		px = document.layers['wrapper'].left;
		var lm = x + nvx + px;
		document.layers[layName].moveTo(lm,tm);
	}
	if (!(this.ie && !this.mac45) || this.opr) {
		clearTimeout(fixedLayer[layName]);
		fixedLayer[layName] = setTimeout("fixedLayer('" + layName + "','" + tm + "','" + lm + "')",100);
	}
}

function fixedWin(){
	var date = new Date();
	var y = date.getFullYear();
	if (document.getElementById) {
		var dw,wl,w,h;
		dw = document.body.offsetWidth;
		wl = document.getElementById('wrapper').offsetLeft;
		w = dw - (wl * 2) + 59;
		h = 20;
		h += document.getElementById('wrapper').offsetHeight;
		h += document.getElementById('upper').offsetHeight;
		h += document.getElementById('bottom').offsetHeight;
		h += document.getElementById('txt_cr').offsetHeight;
		w = parseInt(w,10);
		h = parseInt(h,10);
		if (h > 500) h = 500;
		window.resizeTo(w,h);
		document.getElementById('cr').innerHTML = y;
	}
	else if (document.all) {
		var dw,wl,w,h;
		dw = document.body.offsetWidth;
		wl = document.all('wrapper').offsetLeft;
		w = dw - (wl * 2) + 59;
		h = 20;
		h += document.all('wrapper').offsetHeight;
		h += document.all('upper').offsetHeight;
		h += document.all('bottom').offsetHeight;
		h += document.all('txt_cr').offsetHeight;
		w = parseInt(w,10);
		h = parseInt(h,10);
		if (h > 500) h = 500;
		window.resizeTo(w,h);
		document.all('cr').innerHTML = y;
	}
	else if (document.layers) {
		with (document.layers['cr']) {
			document.open();
			document.write(y);
			document.close();
		}
	}
}

function pjump(leftsp,topsp){
	self.scroll(leftsp,topsp);
	return false;
}

function new_window(pval,wname,wval,hval){
	window.open(pval, wname, 'width=' + wval + 'px,height=' + hval + 'px,directories=0,location=0,menubar=0,status=0,toolbar=0,scrollbars=1,resizable=1');
}

function setcolor(layName,cval){
	if (document.getElementById) {
		document.getElementById(layName).style.color = cval;
	}
	else if (document.all) {
		document.all(layName).style.color = cval;
	}
	else if (document.layers) {
		document.layers[layName].color = cval;
	}
}

function setImage(layName,xval,yval) {
	if (document.getElementById) {
		document.getElementById(layName).style.backgroundPosition = yval + 'px ' + xval + 'px';
	}
	else if (document.all) {
		document.all(layName).style.backgroundPosition = yval + 'px ' + xval + 'px';
	}
	else if (document.layers) {
		document.layers[layName].backgroundPosition = yval + 'px ' + xval + 'px';
	}
}

function searchZipCheck(obj1,obj2){
	var zip1 = "" + obj1.value;
	var zip2 = "" + obj2.value;
	if (zip1.length != 3 || checkNumber(zip1) != true) {
		alert("郵便番号を7桁の半角数字で入力してください");
		obj1.focus();
		return false;
	}
	if (zip2.length != 4 || checkNumber(zip2) != true) {
		alert("郵便番号を7桁の半角数字で入力してください");
		obj2.focus();
		return false;
	}
	function checkNumber(checkint){
		var num;
		for(var j = 0; j < checkint.length; j++ ){
			num = checkint.charAt(j);
			if (num < "0" || num > "9") return false;
		}
		return true;
	}
}

function searchPrefCheck(sel){
	if (sel.options[sel.selectedIndex].value == '') {
		alert("都道府県を選択してください");
		sel.options[0].focus();
		return false;
	}
	else {
		return true;
	}
}
