/*
	HITACHI CONSTRUCTION MACHINERY (au)
	JS FILE [popup_function.js]

Update history ---------------------------------------------------
07/09/05 fixed "openWin" function
------------------------------------------------------------------
 */
	

function makepopupWin(id,listener){
	if(document.getElementById(id)){
		var items = document.getElementById(id);
		items.setAttribute("href",listener);
	}
}


function openWin(){
		/*
			 1. url      2. window name    3. width     4. height    5. resizable
			 6. toolbar  7. scrollbars     8. location  9. menubar  10. status
		*/
		var args = arguments,
		win_set = 'width=' + ((args[2])? args[2] : screen.width-30) 
			+ ',height=' + ((args[3])? args[3] : screen.height-30) 
			+ ',resizable=' + ((args[4])? 1 : 0) 
			+ ',toolbar=' + ((args[5])? 1 : 0) 
			+ ',scrollbars=' + ((args[6])? 1 : 0) 
			+ ',location=' + ((args[7])? 1 : 0) 
			+ ',menubar=' + ((args[8])? 1 : 0) 
			+ ',status=' + ((args[9])? 1 : 0);
		swin = window.open(args[0],args[1],win_set);
		swin.focus();
}

function init_makepopupWin(){
	makepopupWin("stockprice","javascript:openWin('/ir/stock.html','New','700','500',0,0,0)");
	makepopupWin("windowclose","javascript:window.close()");
}

if(w3c){
	window.addOnload(init_makepopupWin);
}


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 setLink(){
	if(is_opener()) document.write('<a href="javascript:window.close();" class="close">Close<img src="' + cdnPath + '/au/images/common/arrow_right.gif" alt="" width="13" height="8"></a>');
	else document.write('<a href="/au/index.html" class="close">Home<img src="' + cdnPath + '/au/images/common/arrow_right.gif" alt="" width="13" height="8"></a>');
}