/* ObjectSwap - Bypasses the new ActiveX Activation requirement in Internet Explorer by swapping existing ActiveX objects on the page with the same objects. Can also be used for Flash version detection by adding the param:
<param name="flashVersion" value="8" /> to the object tag.

Author: Karina Steffens, www.neo-archaic.net
Created: April 2006
Changes and bug fixes: May 2006
Bug fixes: June 2006
*/

//Check if the browser is InternetExplorer, and if it supports the getElementById DOM method
var ie = (document.defaultCharset && document.getElementById && !window.home);

//Hide the object to prevent it from loading twice
if (ie){
	document.write ("<style id='hideObject'> object{display:none;} </style>");
}

/*Replace all flash objects on the page with the same flash object, 
by rewriting the outerHTML values
This bypasses the new IE ActiveX object activation issue*/
objectSwap = function(){
	if (!document.getElementsByTagName){
		return;
	}
	//An array of ids for flash detection
	var stripQueue = [];
	//Get a list of all ActiveX objects
	var objects = document.getElementsByTagName('object');
	for (var i=0; i<objects.length; i++){			
		var o = objects[i];	
		var h = o.outerHTML;
		//The outer html omits the param tags, so we must retrieve and insert these separately
		var params = "";
		var hasFlash = true;
		for (var j = 0; j<o.childNodes.length; j++) {
			var p = o.childNodes[j];
			if (p.tagName == "PARAM"){
				//Check for version first - applies to all browsers
				//For this to work, a new param needs to be included in the object with the name "flashVersion" eg:
				//<param name="flashVersion" value="7" />
				if (p.name == "flashVersion"){
					hasFlash = detectFlash(p.value);
					if (!hasFlash){
						//Add the objects id to the list (create a new id if there's isn't one already)
						o.id = (o.id == "") ? ("stripFlash"+i) : o.id;
						stripQueue.push(o.id);
						break;
					}
				} 
				params += p.outerHTML;		       
			}
		}	
		if (!hasFlash){
			continue;
		}		
		//Only target internet explorer
		if (!ie){
			continue;
		} 
		//Avoid specified objects, marked with a "noswap" classname
		if (o.className.toLowerCase().indexOf ("noswap") != -1){
			continue;
		}		
		//Get the tag and attributes part of the outer html of the object
		var tag = h.split(">")[0] + ">";			
		//Add up the various bits that comprise the object:
		//The tag with the attributes, the params and it's inner html
		var newObject = tag + params + o.innerHTML + " </OBJECT>";		
		//And rewrite the outer html of the tag 
		o.outerHTML = newObject;
	}
	//Strip flash objects
	if (stripQueue.length) {
		stripFlash(stripQueue)
	}
	//Make the objects visible again
	if (ie){
		document.getElementById("hideObject").disabled = true;
	}
}

detectFlash = function(version){
	if(navigator.plugins && navigator.plugins.length){
		//Non-IE flash detection.
		var plugin = navigator.plugins["Shockwave Flash"];
		if (plugin == undefined){
			return false;
		}
		var ver = navigator.plugins["Shockwave Flash"].description.split(" ")[2];
		return (Number(ver) >= Number(version))
	} else if (ie && typeof (ActiveXObject) == "function"){
	//IE flash detection.
		try{
			var flash = new ActiveXObject("ShockwaveFlash.ShockwaveFlash." + version);
			return true;
		}
		catch(e){
			return false;
		}
	}
	//Catchall - skip detection
	return true;
}

//Loop through an array of ids to strip
//Replace the object by a div tag containing the same innerHTML.
//To display an alternative image, message for the user or a link to the flash installation page, place it inside the object tag.  
//For the usual object/embed pairs it needs to be enclosed in comments to hide from gecko based browsers.
stripFlash = function (stripQueue){
	if (!document.createElement){
		return;
	}
	for (var i=0; i<stripQueue.length; i++){
		var o = document.getElementById(stripQueue[i]);
		var newHTML = o.innerHTML;	
		//Strip the comments
		newHTML = newHTML.replace(/<!--\s/g, "");
		newHTML = newHTML.replace(/\s-->/g, "");
		//Neutralise the embed tag
		newHTML = newHTML.replace(/<embed/gi, "<span");		
		//Create a new div element with properties from the object
		var d = document.createElement("div");
		d.innerHTML = newHTML;
		d.className = o.className;
		d.id = o.id;
		//And swap the object with the new div
		o.parentNode.replaceChild(d, o);
	}
}

//Initiate the function without conflicting with the window.onload event of any preceding scripts
var tempFunc = window.onload;
window.onload = function(){
	if (typeof (tempFunc) == "function"){
		try{
			tempFunc();
		} catch(e){}
	}
	objectSwap();
}


var tipTimer;
var timeoutId = false;
//End dHTML Toolltip Timer

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function P7_Snap() { //v2.63 by PVII
 var x,y,ox,bx,oy,p,tx,a,b,k,d,da,e,el,tw,q0,xx,yy,w1,pa='px',args=P7_Snap.arguments;a=parseInt(a);
 if(document.layers||window.opera){pa='';}for(k=0;k<(args.length);k+=4){
 if((g=MM_findObj(args[k]))!=null){if((el=MM_findObj(args[k+1]))!=null){
 a=parseInt(args[k+2]);b=parseInt(args[k+3]);x=0;y=0;ox=0;oy=0;p="";tx=1;
 da="document.all['"+args[k]+"']";if(document.getElementById){
 d="document.getElementsByName('"+args[k]+"')[0]";if(!eval(d)){
 d="document.getElementById('"+args[k]+"')";if(!eval(d)){d=da;}}
 }else if(document.all){d=da;}if(document.all||document.getElementById){while(tx==1){
 p+=".offsetParent";if(eval(d+p)){x+=parseInt(eval(d+p+".offsetLeft"));y+=parseInt(eval(d+p+".offsetTop"));
 }else{tx=0;}}ox=parseInt(g.offsetLeft);oy=parseInt(g.offsetTop);tw=x+ox+y+oy;
 if(tw==0||(navigator.appVersion.indexOf("MSIE 4")>-1&&navigator.appVersion.indexOf("Mac")>-1)){
  ox=0;oy=0;if(g.style.left){x=parseInt(g.style.left);y=parseInt(g.style.top);}else{
  w1=parseInt(el.style.width);bx=(a<0)?-5-w1:-10;a=(Math.abs(a)<1000)?0:a;b=(Math.abs(b)<1000)?0:b;
  x=document.body.scrollLeft+event.clientX+bx;y=document.body.scrollTop+event.clientY;}}
 }else if(document.layers){x=g.x;y=g.y;q0=document.layers,dd="";for(var s=0;s<q0.length;s++){
  dd='document.'+q0[s].name;if(eval(dd+'.document.'+args[k])){x+=eval(dd+'.left');y+=eval(dd+'.top');
  break;}}}e=(document.layers)?el:el.style;xx=parseInt(x+ox+a),yy=parseInt(y+oy+b);
 if(navigator.appVersion.indexOf("MSIE 5")>-1 && navigator.appVersion.indexOf("Mac")>-1){
  xx+=parseInt(document.body.leftMargin);yy+=parseInt(document.body.topMargin);}
 e.left=xx+pa;e.top=yy+pa;}}}
}

function P7_autoLayers() { //v1.4 by PVII
 var g,b,k,f,args=P7_autoLayers.arguments;a=parseInt(args[0]);if(isNaN(a))a=0;
 if(!document.p7setc){p7c=new Array();document.p7setc=true;for(var u=0;u<10;u++){
 p7c[u]=new Array();}}for(k=0;k<p7c[a].length;k++){if((g=MM_findObj(p7c[a][k]))!=null){
 b=(document.layers)?g:g.style;b.visibility="hidden";}}for(k=1;k<args.length;k++){
 if((g=MM_findObj(args[k]))!=null){b=(document.layers)?g:g.style;b.visibility="visible";f=false;
 for(var j=0;j<p7c[a].length;j++){if(args[k]==p7c[a][j]) {f=true;}}
 if(!f){p7c[a][p7c[a].length++]=args[k];}}}
}



function locateObject(n, d) { //v3.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=locateObject(n,d.layers[i].document); return x;
}

// macromedia tooltip version: 2.0.1
function hideTooltip(object) {
	if (document.all || document.getElementById) {
		var o = MM_findObj(object); o.style.visibility="hidden"; o.style.left = 1;	o.style.top = 1;
		return false;
	} else if (document.layers) {
		var o = MM_findObj(object); o.visibility="hide"; o.left = 1; o.top = 1;
		return false;
	} else return true
}

// tooltip for d01, d02, d03, d04
function showTooltip(object,e, tipContent, backcolor, bordercolor, textcolor,displaytime,font) {
	if (!font || font=='') font = 'Verdana, Arial, Helvetica, sans-serif';
  var tooltip_width = get_tooltip_width(tipContent);
  var content1 = '<table width="'+tooltip_width+'" style="font-family: '+font+'; font-size: 11px; border: '+bordercolor+'; border-style: solid; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; background-color: '+backcolor+'" border="0" cellspacing="1" cellpadding="1"><tr><td><font style="font-family: '+font+'; font-size: 11px; color: '+textcolor+'">'+unescape(tipContent)+'</font></td></tr></table>';
  var content2 = '<table width="'+tooltip_width+'" border="0" cellspacing="1" cellpadding="1"><tr bgcolor="'+bordercolor+'"><td><table width="10" border="0" cellspacing="0" cellpadding="2"><tr bgcolor="'+backcolor+'"><td><font style="font-family: '+font+'; font-size: 11px; color: '+textcolor+'">'+unescape(tipContent)+'</font></td></tr></table><td></tr></table>';
  showTooltip_base(object,e, displaytime, content1, content2);
}


// show a tooltip according to a class for d05, d06, d09
function showTooltip2(object,e, tipContent, tooltip_class, displaytime) {
  var tooltip_width = get_tooltip_width(tipContent);
  var content1 = '<table class="'+tooltip_class+'" width="'+ tooltip_width+'" border="0" cellspacing="1" cellpadding="1"><tr><td>'+unescape(tipContent)+'</td></tr></table>';
  var content2 = content1;
  showTooltip_base(object,e, displaytime, content1, content2);
}

// for design d07
function showTooltip7(object,e, tipContent, defaultpath2, css_pre, tooltip_back_s, tooltip_text_s, displaytime) {
  var tooltip_width = get_tooltip_width(tipContent);
  var content1 = '<table border="0" cellpadding="0" cellspacing="0" width="'+tooltip_width+'"><tr><td style="background-color: none;">         <img src="'+defaultpath2+'img_caption_left_top4.gif" style="display: block;"/>        </td>        <td background="'+defaultpath2+'img_caption_top_center4.gif">          <img src="'+defaultpath2+'img_caption_top_center4.gif" style="display: block;"/>        </td>        <td>          <img src="'+defaultpath2+'img_caption_right_top4.gif" style="display: block;"/>        </td>      </tr>      <tr>        <td background="'+defaultpath2+'img_caption_left_center3.gif" height="100%">          <img src="'+defaultpath2+'img_caption_left_center3.gif" style="display: block;"/>        </td>        <td width="100%">          <table width="100%" class="'+tooltip_back_s+'" border="0" cellpadding="0" cellspacing="0">            <tr>              <td valign="top" class="'+tooltip_text_s+'">'+unescape(tipContent)+'</td>            </tr>          </table>        </td>        <td background="'+defaultpath2+'img_caption_right_center3.gif" height="100%">          <img src="'+defaultpath2+'img_caption_right_center3.gif" style="display: block;"/>        </td>      </tr>      <tr>        <td>          <img src="'+defaultpath2+'img_caption_left_bottom3.gif" style="display: block;"/>        </td>        <td background="'+defaultpath2+'img_caption_bottom3.gif"/>        <td>          <img src="'+defaultpath2+'img_caption_right_bottom3.gif" style="display: block;"/>        </td>      </tr>    </table>';
  var content2 = content1;
  showTooltip_base(object,e, displaytime, content1, content2);
}

// for design d08
function showTooltip8(object,e, tipContent, defaultpath2, css_pre, tooltip_back_s, tooltip_text_s, displaytime) {
  var tooltip_width = get_tooltip_width(tipContent);
  var content1 = '<table border="0" cellpadding="0" cellspacing="0" width="'+tooltip_width+'"><tr><td style="background-color: none;"><img src="'+defaultpath2+'frame_left_top.gif" style="display: block;"></td><td background="'+defaultpath2+'frame_top_center.gif"><img src="'+defaultpath2+'frame_top_center.gif" style="display: block;"></td><td><img src="'+defaultpath2+'frame_right_top.gif" style="display: block;"></td></tr><tr><td background="'+defaultpath2+'frame_left_center.gif" height="100%"><img src="'+defaultpath2+'frame_left_center.gif" style="display: block;"></td><td width="100%" class="'+tooltip_back_s+'"><table border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"class="'+tooltip_text_s+'">'+unescape(tipContent)+'</td></tr></table></td><td  background="'+defaultpath2+'frame_right_center.gif" height="100%"><img src="'+defaultpath2+'frame_right_center.gif" style="display: block;"></td></tr><tr><td><img src="'+defaultpath2+'frame_left_bottom.gif" style="display: block;"></td><td background="'+defaultpath2+'frame_bottom.gif"></td><td><img src="'+defaultpath2+'frame_right_bottom.gif" style="display: block;"></td></tr></table>';
  var content2 = content1;
  showTooltip_base(object,e, displaytime, content1, content2);
}

// for design d10
function showTooltip10(object,e, tipContent, defaultpath2, css_pre, tooltip_back_s, tooltip_text_s, displaytime) {
  var tooltip_width = get_tooltip_width(tipContent);
  var content1 = '<table border="0" cellpadding="0" cellspacing="0" width="'+tooltip_width+'"><tr><td style="background-color: none;"><img src="'+defaultpath2+'frame_left_top.gif" style="display: block;"></td><td background="'+defaultpath2+'frame_top_center.gif"><img src="'+defaultpath2+'frame_top_center.gif" style="display: block;"></td><td><img src="'+defaultpath2+'frame_right_top.gif" style="display: block;"></td></tr><tr><td background="'+defaultpath2+'frame_left_center.gif" height="100%"><img src="'+defaultpath2+'frame_left_center.gif" style="display: block;"></td><td width="100%" class="'+tooltip_back_s+'"><table border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"class="'+tooltip_text_s+'">'+unescape(tipContent)+'</td></tr></table></td><td  background="'+defaultpath2+'frame_right_center.gif" height="100%"><img src="'+defaultpath2+'frame_right_center.gif" style="display: block;"></td></tr><tr><td><img src="'+defaultpath2+'frame_left_bottom.gif" style="display: block;"></td><td background="'+defaultpath2+'frame_bottom.gif"></td><td><img src="'+defaultpath2+'frame_right_bottom.gif" style="display: block;"></td></tr></table>';
  var content2 = content1;
  showTooltip_base(object,e, displaytime, content1, content2);
}

// for design d11
function showTooltip11(object,e, tipContent, defaultpath2, css_pre, displaytime) {
  var tooltip_width = get_tooltip_width(tipContent);
  var content1 = '<img src="'+defaultpath2+'bullet_8.gif" width="5" height="3" hspace="1"><br/><table width="'+tooltip_width+'" border="0" cellspacing="0" cellpadding="4"><tr><td bgcolor="#000000"><table width="100%" border="0" cellspacing="0" cellpadding="1"><tr><td bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="10" cellspacing="0"><tr> <td bgcolor="#EEF0F4" class="'+ css_pre +'plaintx">'+unescape(tipContent)+'</td></tr></table></td></tr></table></td></tr></table>';
  var content2 = content1;
  showTooltip_base(object,e, displaytime, content1, content2);
}

// for design d13
function showTooltip13(object,e, tipContent, defaultpath2, tooltip_back_s, tooltip_text_s, displaytime) {
  var tooltip_width = get_tooltip_width(tipContent);
  var content1 = '<table cellpadding="0" cellspacing="0" border="0"><tr><td><img src="'+defaultpath2+'box_frame1_left_top.gif" style="display: block;"/></td><td background="'+defaultpath2+'box_frame1_top_center.gif"/><td><img src="'+defaultpath2+'box_frame1_right_top.gif" style="display: block;"/></td></tr><tr><td background="'+defaultpath2+'box_frame1_left_center.gif"/><td class="'+tooltip_back_s+'"><table width="'+tooltip_width+'" cellpadding="3" cellspacing="0" class="'+tooltip_back_s+'"><tr><td valign="top" class="'+tooltip_text_s+'">'+unescape(tipContent)+'</td></tr></table></td><td background="'+defaultpath2+'box_frame1_right_center.gif"/></tr><tr><td><img src="'+defaultpath2+'box_frame1_left_bottom.gif"/></td><td background="'+defaultpath2+'box_frame1_bottom_center.gif"/><td><img src="'+defaultpath2+'box_frame1_right_bottom.gif"/></td></tr></table>';
  var content2 = content1;
  showTooltip_base(object,e, displaytime, content1, content2);
}

// for design d15
function showTooltip15(object,e, tipContent, defaultpath2, css_pre, displaytime) {
  var tooltip_width = get_tooltip_width(tipContent);
  var content1 = '<table width="'+tooltip_width+'" border="0" cellspacing="0" cellpadding="1"><tr><td bgcolor="#000000"><table width="100%" border="0" cellspacing="0" cellpadding="1"><tr><td bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="5" cellspacing="0"><tr> <td bgcolor="#F5F5F5" class="'+css_pre+'tx">'+unescape(tipContent)+'</td></tr></table></td></tr></table></td></tr></table>';
  var content2 = content1;
  showTooltip_base(object,e, displaytime, content1, content2);
}
// for design d16
function showTooltip16(object,e, tipContent, defaultpath2, css_pre, displaytime) {
  var tooltip_width = get_tooltip_width(tipContent);
  var content1 = '<table width="'+tooltip_width+'" border="0" cellspacing="0" cellpadding="1"><tr><td bgcolor="#000000"><table width="100%" border="0" cellspacing="0" cellpadding="1"><tr><td bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="5" cellspacing="0"><tr> <td bgcolor="#FED062" class="'+css_pre+'tx">'+unescape(tipContent)+'</td></tr></table></td></tr></table></td></tr></table>';
  var content2 = content1;
  showTooltip_base(object,e, displaytime, content1, content2);
}
// for design d17
function showTooltip17(object,e, tipContent, defaultpath2, css_pre, displaytime) {
  var tooltip_width = get_tooltip_width(tipContent);
  var content1 = '<table width="'+tooltip_width+'" border="0" cellspacing="0" cellpadding="1"><tr><td bgcolor="#B52B26"><table width="100%" border="0" cellspacing="0" cellpadding="1"><tr><td bgcolor="#FFFFFF"><table width="100%" border="0" cellpadding="10" cellspacing="0"><tr> <td bgcolor="#EBEBEB" class="'+css_pre+'contentPlainTx">'+unescape(tipContent)+'</td></tr></table></td></tr></table></td></tr></table>';
  var content2 = content1;
  showTooltip_base(object,e, displaytime, content1, content2);
}

/*
function showTooltip(object,e, tipContent, defaultpath2, css_pre, displaytime) {
  var tooltip_width = get_tooltip_width(tipContent);
  var content1 = '';
  var content2 = content1;
  showTooltip_base(object,e, displaytime, content1, content2);
}
*/
////////////////
// base function for tooltip
function get_tooltip_width(tipContent) {
  var tooltip_width;
  var char_per_row = 0;
  tip_arr = tipContent.split("<br/>");
  for (i=0;i<tip_arr.length;i++)
  {
    if (tip_arr[i].length > char_per_row)
      char_per_row = tip_arr[i].length;
  }
	if (document.all || document.getElementById)
	{
		if (document.getElementById && !document.all)
      tooltip_width = char_per_row > window.innerWidth/8?window.innerWidth/2:char_per_row * 4;
		else
      tooltip_width = char_per_row > document.body.clientWidth/8?document.body.clientWidth/2:char_per_row * 4;
  }
	else if (document.layers)
	{
    tooltip_width = char_per_row > window.innerWidth/8?window.innerWidth/2:char_per_row * 4;
  }
  return tooltip_width;
}
function showTooltip_base(object,e, displaytime, content1, content2) {
  window.clearTimeout(timeoutId);

	if (document.all || document.getElementById)
	{
		var o = MM_findObj(object),mouseX,mouseY,oc=o.style,db=document.body;
		var tooltip_width;
    o.innerHTML=content1;
		if (document.getElementById && !document.all)
		{
			mouseX = e.pageX; mouseY = e.pageY;
			oc.left = ((mouseX + o.offsetWidth) > (window.innerWidth-20 + window.pageXOffset)) ? mouseX - o.offsetWidth -10 : window.pageXOffset+mouseX;
		}
		else
		{
			mouseX = window.event.clientX + db.scrollLeft;
			mouseY = window.event.clientY + db.scrollTop;
			oc.left = ((e.x + o.clientWidth) > (db.clientWidth + db.scrollLeft)) ? (db.clientWidth + db.scrollLeft) - o.clientWidth-10 : mouseX;
		}
		oc.top=mouseY+20; oc.visibility="visible";
		timeoutId = window.setTimeout("hideTooltip('"+object+"')", displaytime);
		return true;
	}
	else if (document.layers)
	{
		var o = MM_findObj(object);
		o.document.write(content2);
		o.document.close(); o.top=e.y+20;
		o.left = ((e.x + o.clip.width) > (window.pageXOffset + window.innerWidth)) ? window.innerWidth - o.clip.width-10 : e.x;
		o.visibility="show"
		timeoutId = window.setTimeout("hideTooltip('"+object+"')", displaytime);
		return true;
	}
	else return true;
}
////////////////////


// felnyilo nagy kep
function popup_image(file,title,x,y) {
xx = x + 32;
yy = y + 42;
if (screen.width < xx) xx = screen.width;
if (screen.height-25 < yy) yy = screen.height-25;

popupwin = window.open('','_blank','resizable=no,scrollbars=1,toolbar=no,location=no,directories=no,status=no,menubar=no,top=0,left=0,width=1,height=1');
popupwin.resizeTo(xx,yy);
popupwin.focus();
popupwin.document.open("text/html");
popupwin.document.clear();
popupwin.document.write("<HTML><HEAD>");
popupwin.document.write("<TITLE>");
popupwin.document.write(title);
popupwin.document.write("</TITLE></HEAD><body marginwidth='0' marginheight='0' leftmargin='0' topmargin='0'>");
popupwin.document.write("<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td align='center'>");
popupwin.document.write("<a href='javascript:self.close()'>");
popupwin.document.write("<img border='0' alt='Bezáráshoz kattintson a képre!' src='");
popupwin.document.write(file);
popupwin.document.write("' width='");
popupwin.document.write(x);
popupwin.document.write("' height='");
popupwin.document.write(y);
popupwin.document.write("'/>");
popupwin.document.write("'</a>");
popupwin.document.write("</td></tr></table>");
popupwin.document.write("</BODY></HTML>");
popupwin.document.close();
}

// felnyilo nagy kep 2 version i16n
function popup_image2(file,title,close,x,y) {
xx = x + 32;
yy = y + 42;
if (screen.width < xx) xx = screen.width;
if (screen.height-25 < yy) yy = screen.height-25;

popupwin = window.open('','_blank','resizable=no,scrollbars=1,toolbar=no,location=no,directories=no,status=no,menubar=no,top=0,left=0,width=1,height=1');
popupwin.resizeTo(xx,yy);
popupwin.focus();
popupwin.document.open("text/html");
popupwin.document.clear();
popupwin.document.write("<HTML><HEAD>");
popupwin.document.write("<TITLE>");
popupwin.document.write(title);
popupwin.document.write("</TITLE></HEAD><body marginwidth='0' marginheight='0' leftmargin='0' topmargin='0'>");
popupwin.document.write("<table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td align='center'>");
popupwin.document.write("<a href='javascript:self.close()'>");
popupwin.document.write("<img border='0' alt='"+close+"' src='");
popupwin.document.write(file);
popupwin.document.write("' width='");
popupwin.document.write(x);
popupwin.document.write("' height='");
popupwin.document.write(y);
popupwin.document.write("'/>");
popupwin.document.write("'</a>");
popupwin.document.write("</td></tr></table>");
popupwin.document.write("</BODY></HTML>");
popupwin.document.close();
}


function LTrim(str)
/*
   PURPOSE: Remove leading blanks from our string.
   IN: str - the string we want to LTrim
*/
{
   var whitespace = new String(" \t\n\r");
   var s = new String(str);

   if (whitespace.indexOf(s.charAt(0)) != -1) {
      // We have a string with leading blank(s)...
      var j=0, i = s.length;

      // Iterate from the far left of string until we
      // don't have any more whitespace...
      while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
         j++;

      // Get the substring from the first non-whitespace
      // character to the end of the string...
      s = s.substring(j, i);
   }
   return s;
}

function RTrim(str)
/*
   PURPOSE: Remove trailing blanks from our string.
   IN: str - the string we want to RTrim

*/
{
   // We don't want to trip JUST spaces, but also tabs,
   // line feeds, etc.  Add anything else you want to
   // "trim" here in Whitespace
   var whitespace = new String(" \t\n\r");
   var s = new String(str);

   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
      // We have a string with trailing blank(s)...
      var i = s.length - 1;       // Get length of string

      // Iterate from the far right of string until we
      // don't have any more whitespace...
      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
         i--;

      // Get the substring from the front of the string to
      // where the last non-whitespace character is...
      s = s.substring(0, i+1);
   }
   return s;
}
