// JavaScript Document
var dom_implementation = document.implementation && true;
var dom_cerate_document = dom_implementation && document.implementation.createDocument;
var dom_feature = dom_implementation && document.implementation.hasFeature;
var moz = dom_cerate_document && dom_feature;
var safari = (navigator.userAgent && navigator.vendor && (navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1 || navigator.vendor.indexOf("Apple") != -1));
var ie = document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1  && navigator.userAgent.toLowerCase().indexOf("opera") == -1;
var nn4 = (navigator.appName.indexOf("Netscape") > -1 && navigator.appVersion.indexOf("4") > -1) ? true:false                 
var nn6 = (document.getElementById) ? true:false
var java_vitrin; 


function getId(id){
//var layer = (nn4) ? document.layers[id] : (ie) ? document.all[id] : document.getElementById(id) ; 
var layer = document.getElementById(id) ; 
return layer; 
}

function createBookmarkLink(title,url) {

	if (window.sidebar) 
	{ // Mozilla Firefox Bookmark
		window.sidebar.addPanel(title, url,"");
	} 
	else if( window.external ) 
	{ // IE Favorite
		window.external.AddFavorite( url, title); 
	}
	else if(window.opera && window.print) 
	{ // Opera Hotlist
		return true; 
	}
 }

function addEvent( obj, type, fn ) {
	if (obj.addEventListener) {
		obj.addEventListener( type, fn, false );
		EventCache.add(obj, type, fn);
	}
	else if (obj.attachEvent) {
		obj["e"+type+fn] = fn;
		obj[type+fn] = function() { obj["e"+type+fn]( window.event ); }
		obj.attachEvent( "on"+type, obj[type+fn] );
		EventCache.add(obj, type, fn);
	}
	else {
		obj["on"+type] = obj["e"+type+fn];
	}
}


var EventCache = function(){
	var listEvents = [];
	return {
		listEvents : listEvents,
		add : function(node, sEventName, fHandler){
		listEvents.push(arguments);
	},
	flush : function(){
	var i, item;
	for(i = listEvents.length - 1; i >= 0; i = i - 1){
	item = listEvents[i];
		if(item[0].removeEventListener){
			item[0].removeEventListener(item[1], item[2], item[3]);
		};
		if(item[1].substring(0, 2) != "on"){
			item[1] = "on" + item[1];
		};
		if(item[0].detachEvent){
			item[0].detachEvent(item[1], item[2]);
		};
		item[0][item[1]] = null;
	};
	}
	};
}();


function sysDialogBoxWindowLoad(obj) {
	$("#SysDialogBoxWindow").load(jQuery(obj).attr("href"));
	$("#SysDialogBoxWindow").dialog("open");
	return false; 
}

function sysTopLinkBlockLoad(obj,id) {
	var divId = $(obj).attr("title");
	$('#linkMiddleBar > ul').tabs('select', id);
	$('#'+divId).load($(obj).attr("href"));
	$.scrollTo('#linkMiddleBar', 800);
	return false; 
}

function flashTextPrint(fontName,id,width,height,fColor,fSize,fLineHeight,fLineColor,fnoLine){
	innerHtml = $('#'+id).html();
	$('#'+id).html('');
	$('#'+id).flash ({ src: '/_interface/_swf/font/'+fontName+'.swf',  width: width,  height: height, flashvars: { cdata:innerHtml , fColor:fColor, fSize:fSize, fLineHeight:fLineHeight,fLineColor:fLineColor,fnoLine:fnoLine }, wmode: 'transparent', bgcolor: '#FFFFFF' });
}

function printFaceboxPage(){
		$.jPrintArea('#SysDialogBoxWindow');
        $.facebox.close();
}

function formSelectSelectButton(obj) {
	listenerId=obj.id; 
	inputIdName=listenerId+'check';
	inputValue=getId(inputIdName).value; 
	if(inputValue==0) {
		getId(inputIdName).value='1'; 
		obj.className='selected';
	} else {
		getId(inputIdName).value='0';
		obj.className='noselected';
	}
} 

function formSelectRadioButton(id,numOfValue,value) {
	radioId = id+'radio'; 
	for (i=1; i<=numOfValue; i++){
		containerId = id+i; 
		if(i==value) {
			getId(containerId).className='selected';
			getId(radioId).value = i; 
		} else {
			getId(containerId).className='noselected';
		}
	} 
	
} 


