

var all_window = new Array();
function OpenWin(cur_href, cur_win, show_options, width, height){
   
    if (!document.getElementById) return;
   
	cur_win = cur_win.replace(/ /g,'_');
		
    var w_str = "";
    var c_width = 0;
    if( !width ) {

    	if( typeof( window.innerWidth ) == 'number' ) {
        	//Non-IE
        	c_width = window.innerWidth;
    	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        	//IE 6+ in 'standards compliant mode'
        	c_width = document.documentElement.clientWidth;
    	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        	//IE 4 compatible
        	c_width = document.body.clientWidth;
    	}
    	c_width = c_width - 100;
		w_str = ",width=" + c_width;
    }else{
		c_width = width;
		w_str = ",width=" + c_width;
	}
	
	
    var h_str = "";
	var c_height = 0;
    if( !height ) {

    	if( typeof( window.innerWidth ) == 'number' ) {
        	//Non-IE
        	c_height = window.innerHeight;
    	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
        	//IE 6+ in 'standards compliant mode'
        	c_height = document.documentElement.clientHeight;
    	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        	//IE 4 compatible
        	c_height = document.body.clientHeight;
    	}
    	c_height = c_height - 100;
		h_str = ",height=" + c_height;
    }else{
		c_height = height;
		h_str = ",height=" + c_height;
	}
    
	
    if (!all_window[cur_win] || all_window[cur_win].closed){
		
		var win_opt = "";
		
		if (show_options == false){
        	win_opt = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes" + w_str + h_str;
		}else{
        	win_opt = "toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes" + w_str + h_str;
		}

        all_window[cur_win] = window.open(cur_href,cur_win,win_opt);
    }else{
        all_window[cur_win].focus();
    }
 
}
