/*
	Panasonic Global
	JS FILE [menu_function.js]
	This file contains the definition of "menu highlight".
 */




/* 1. AuserAgent
--------------------------------------------------------------------------	*/
var agent = navigator.userAgent.toLowerCase();
var vers = navigator.appVersion.charAt(0);
var dname = new String(document.domain);
var path = new String(location.pathname);
var win = (agent.indexOf("windows") != -1);
var mac = (agent.indexOf("mac") != -1);
var w3c = document.getElementById;
var gecko = agent.indexOf("gecko") != -1;
var opera = agent.indexOf("opera",0) != -1;
var safari = agent.indexOf("safari") != -1;
var ie = agent.indexOf("msie") != -1 && !opera;
var ie5win = (agent.indexOf("msie 5.0") != -1) && win;
var ie55win = (agent.indexOf("msie 5.5") != -1) && win;
var ie6win = (agent.indexOf("msie 6.") != -1) && win;
var ie5mac = (agent.indexOf("msie") != -1) && mac;
var ns6 = (agent.indexOf("netscape") != -1) && (vers > 4) && !opera;
var pth = new String(location.pathname);
var rpath = (pth.indexOf("panasonic.net") > 0)? "/panasonic.net/common" : "/common";

/* 2. Header Form
--------------------------------------------------------------------------	*/
function commonSearchKey(){
	if(document.commonSearch.qt.value.length == 0){
		alert("Please enter keyword.");
		return false;
	} else {
		return true;
	}
}

function setvalue_E(id,sw){
	if (sw == 'on'){
		if (id.value.indexOf('Search Keyword') > -1) {
			id.value='';
		}
	} else {
		if (id.value == '') {
			id.value = '> Search Keyword';
		}
	}
}



/* 3. Onlod function
--------------------------------------------------------------------------	*/
function addEvent(obj, type, listener) {
	if(window.addEventListener) window.addEventListener('load',listener,false);
	else {
		var prev  = obj[type];
		obj[type] = (prev) ? function() { prev(); listener(); } : listener;
	}
}

window.addOnload = function(listener){
	addEvent(window, 'onload', listener);
}



/* 4. Popup window
--------------------------------------------------------------------------	*/
function openWin(url,wname,w,h,scroll){
		/*if(safari){w += 15;h += 45;}*/
		if(win && ie){w += (scroll)? 16:0;h -= 19;}
		var str = 'width=' + w+ ',height=' + h;
			str += ',location=0,toolbar=1,menubar=1,scrollbars=' + scroll + ',resizable=1';
		swin = window.open(url,wname,'width=' + w + ',height=' + h + str);
		swin.focus();
}



/* 5. load marge.css
--------------------------------------------------------------------------	*/
function setCss(){
		document.open();
		document.write("<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"" + rpath + "/css/marge.css\">\n");
		document.close();
}
var setupCss = new setCss;



/* 6. popup function
--------------------------------------------------------------------------	*/
function is_opener() {
	var ua = navigator.userAgent
	if(!!window.opener)
		if( ua.indexOf('MSIE 4')!=-1 && ua.indexOf('Win')!=-1) 
			return !window.opener.closed
		else return typeof window.opener.document  == 'object'
	else return false
}


function setFooter(){
	if(is_opener()){document.write('<ul><li class="btn-close"><a href="#" onclick="window.close();return false;">Close</a></li></ul>');}
	else{document.write('<ul><li class="btn-back"><a href="#" onclick="history.back(-1);return false;">Return to Page</a></li></ul>');}
}



