
//	Check and submit
function CheckAndSubmit(id){
	var flag = true;
	$("#"+id+" .ness").each(function(){
		if( $(this).val() == "" ) {
			$(this).focus().addClass("ness_bord");
			flag = false;
			return false;
		} else {
			$(this).removeClass("ness_bord");
		}
	});
	if(flag) {
		$("#"+id).submit();
		return false;
	}
	else return false;
}

//	try { document.execCommand("BackgroundImageCache", false, true); } catch(err) {} 

	var hwnd;
	
	function show_hint(id) {
		var layer = document.getElementById(id);
			layer.style.display = "block"; 
	}
	function hide_hint(id) {
		var layer = document.getElementById(id);
			layer.style.display = "none"; 
	}
	
	function openwin( img , w , h , title ) {
		if( hwnd != null )
		hwnd.close();
		hwnd = window.open( img , "" , "toolbar=no , location=no , directories=no , resizable=no , width=" + w + " , height=" + h );
		hwnd.document.open();
		hwnd.document.write("<html>");
		hwnd.document.write("<head>");
		hwnd.document.write("<title>" + title + "</title>");
		hwnd.document.write("</head>");
		hwnd.document.write("<body bgcolor=#ffffff bottommargin=0 leftmargin=0 marginheight=0 marginwidth=0 rightmargin=0 topmargin=0 style='border:0px;'>");
		hwnd.document.write("<table align=center width=100% height=100% cellspacing=0 cellpadding=0 border=0>");
		hwnd.document.write("<tr><td><img src='" + img + "' border=0></td></tr>");
		hwnd.document.write("</table></body></html>");
		hwnd.document.close();
	}
	
	function open_swf( swf , w , h , title ) {
		if( hwnd != null )
		hwnd.close();
		hwnd = window.open( swf , "" , "toolbar=no , location=no , directories=no , resizable=no , width=" + w + " , height=" + h );
		hwnd.document.open();
		var cont = "<html>\n<head>\n<title>Flash</title>\n</head>\n<body style='padding:0;margin:0'>\n<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0' width='"+w+"' height='"+h+"'>\n<param name=movie value='"+swf+"'>\n<param name=quality value=high>\n<param name=wmode value=transparent>\n<embed src='"+swf+"' quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='"+w+"' height='"+h+"' wmode=transparent>\n</embed>\n</object>\n</body>\n</html>\n";
		hwnd.document.write(cont);
		hwnd.document.close();
	}

	function openwin_text( url , w , h ) {
		window.open( url , "" , "toolbar=no , location=no , directories=no , resizable=no , scrollbars=yes , width=" + w + " , height=" + h );
	}

	function pics( img , url ) {
			document.images[img].src = url;
	}

	function redirect( uri ) {
		document.location.href = uri;
	}

	function ShowDiv( id ) {
		var layer = document.getElementById(id);
			layer.style.display = "block"; 
	}

	function HideDiv( id ) {
		var layer = document.getElementById(id);
			layer.style.display = "none"; 
	}

	function show( id ) {
		var layer = document.getElementById(id);
		if( layer.style.display == "none" )
			layer.style.display = "block"; 
		else
			layer.style.display = "none"; 
	}

	function colorChange( id , bgColor ) {
		var el = document.getElementById( id );
		el.style.backgroundColor = bgColor;
	}

	function preload() {
		var numArgs = arguments.length;
		if ( numArgs > 0 ) {
			arr = new Array()
			for( var i = 0; i < numArgs; i++ ) {
				arr[i] = new Image();
				arr[i].src = arguments[i];
			}
		}
	}

	var selected_id = null; 
	var dom = document.getElementById; 
	function chi( id , newclass ) { 
		if (dom) {
			if(selected_id != id) {
				el = document.getElementById(id);
				el.className = newclass;
				el.style.cursor = "hand";
				el.style.cursor = "pointer";
			}
		}
	} 
	
function addBookmark(url, title) {
  if (!url) url = location.href;
  if (!title) title = document.title;
  

  if ((typeof window.sidebar == "object") && (typeof window.sidebar.addPanel == "function")) window.sidebar.addPanel (title, url, "");
  //IE4+
  else if (typeof window.external == "object") window.external.AddFavorite(url, title);
  //Opera7+
  else if (window.opera && document.createElement)
  {
    var a = document.createElement('A');
    if (!a) return false; //IF Opera 6
    a.setAttribute('rel','sidebar');
    a.setAttribute('href',url);
    a.setAttribute('title',title);
    a.click();
  }
  else return false;
  
  return true;
}