// JScript File

function createBookmark( url, title )
{
	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 showNote( lyr )
{
	var scrollX = (document.all) ? document.body.scrollLeft : window.pageXOffset
	var scrollY = (document.all) ? document.body.scrollTop : window.pageYOffset
	document.getElementById(lyr).style.visibility = 'visible';
	document.getElementById(lyr).style.display = 'inline';
}

function hideNote( lyr )
{ 
	document.getElementById(lyr).style.visibility='hidden';
	document.getElementById(lyr).style.display = 'none';
}

function showMsg( msg )
{
	window.status = msg;
	return true;
}

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];}
}
				
var downStrokeField;

function autojump(fieldName, nextFieldName, fakeMaxLength)
{
	var myForm = document.forms[document.forms.length - 1];
	var myField = myForm.elements[fieldName];
	
	myField.nextField = myForm.elements[nextFieldName];

	if (myField.maxLength == null)
		myField.maxLength=fakeMaxLength;

	myField.onkeydown = autojump_keyDown;
	myField.onkeyup = autojump_keyUp;
}

function autojump_keyDown()
{
	this.beforeLength = this.value.length;
	downStrokeField = this;
}

function autojump_keyUp()
{
	if (
		this == downStrokeField && 
		this.value.length > this.beforeLength && 
		this.value.length >= this.maxLength
	)
	
	this.nextField.focus();
	
	downStrokeField = null;
}

function showpopup2( pageToLoad, winName, width, height, center,scroll)
{
		xposition = 0; yposition = 0;
		
		if ((parseInt(navigator.appVersion) >= 4 ) && (center))
		{
			xposition = (screen.width - width) / 2;
			yposition = (screen.height - height) / 2;
		}
		
		args = "width=" + width + "," + "height=" + height + "," + "location=0," + "menubar=0," + "resizable=1," + "scrollbars=" + scroll + "," + "status=0," + "titlebar=0," + "toolbar=0," + "hotkeys=0," + "screenx=" + xposition + "," + "screeny=" + yposition + "," + "left=" + xposition + "," + "top=" + yposition;           
		window.open( pageToLoad,winName,args );
}

function tk(ref)
{
	var url = "logit.aspx?ref=" + ref;

	if ( window.XMLHttpRequest )
		req = new XMLHttpRequest();
	else if ( window.ActiveXObject )
	{
		try
		{
			req = new ActiveXObject( "Msxml2.XMLHTTP" );
		}
		catch(e)
		{
			req = new ActiveXObject( "Microsoft.XMLHTTP" );
		}
	}
	
	req.open( "GET", url, true );
	req.send( null );
}

function SiteAttribution(url)
{
	if ( window.XMLHttpRequest )
	    req = new XMLHttpRequest();
	else if ( window.ActiveXObject )
	{
	    try
    	{
	   		req = new ActiveXObject( "Msxml2.XMLHTTP" );
	    }
	    catch(e)
    	{
	   		req = new ActiveXObject( "Microsoft.XMLHTTP" );
	    }
	}
    req.open( "GET", url, true );
	req.send( null );
	
}
function async_load(divname) 
{
    var node;
    try {
        // variable _asyncDom is set from JavaScript in the iframe
        // node = top._asyncDom.cloneNode(true); // kills Safari 1.2.4
        node = top._asyncDom;
        // try to remove the first script element, the one that
        // executed all document.writes().
        node.removeChild(node.getElementsByTagName("javascript")[0]);
    } catch (e) { 
    }
    try {
        // insert DOM fragment at a DIV with id "divname" on current page
        document.getElementById(divname).appendChild(node);
    } catch (e) {
        try {
	        // fallback for some non DOM compliant browsers
            document.getElementById(divname).innerHTML = node.innerHTML;
        } catch (e1) {};
    }
}

function async_load2(frameid,divname,identifername)
{
    var childLoader = document.getElementById(frameid);
    var childDoc = (childLoader.contentDocument ?
                   childLoader.contentDocument :            // W3C
                   window.frames[childLoader.id].document); // IE

    // childDoc is the reference to the document object of the loaded
    // page and can be used as any other document object.
    try
    {
    document.getElementById(divname).appendChild(childDoc.getElementById(identifername));
    }
    catch (e) {
        try {
	        // fallback for some non DOM compliant browsers
            document.getElementById(divname).innerHTML = childDoc.getElementById(identifername).innerHTML;
        } catch (e1) {};
    }
}

function breakout_of_frame() 
{
  if (top.location != location) 
  {
    top.location.href = document.location.href;
  }
}



function findPos(obj)
{
    var curleft = curtop = 0;
    if (obj.offsetParent)
    {
        curleft = obj.offsetLeft
        curtop = obj.offsetTop
        while (obj = obj.offsetParent)
        {
	        curleft += obj.offsetLeft
	        curtop += obj.offsetTop
        }
    }
    return [curleft,curtop];
}

function popup(autohide)
{
    if(showing)
    {
        if(win)
        {
	        if(win.closed == false)
	        {
		        return;
	        }
        }
        else
        {
	        return;
        }
    }
    showing = true;
    win = document.getElementById("__logo_div__");
    el = document.getElementById("__logo__");
    pos = findPos(el);
    win.style.left = pos[0] - 182;
    win.style.top = pos[1] + 116;
    win.style.visibility = 'visible';

    if(autohide) window.setTimeout("hideBanner()", 3000);

}

function hideBanner()
{
    if(win)
    {
        win.style.visibility = 'hidden';
    }
    return false;
}

function ShowImage(PictureID, Description)
{
    var imageId = document.getElementById(PictureID);
   
    if (imageId == null)
    {
        return false;
    }
    
    var imageUrl = imageId.src;
   
    infoWin=window.open("", "imgWin", "height=600, width=500, toolbar=no, scrollbars=auto, resizable=yes, menubar=no");
    infoWin.document.write("<html>")
    infoWin.document.write("<title>Image</title>")
    infoWin.document.write("<body>")
    infoWin.document.write("<img src=\"" + imageUrl +"\" width=\"450\" height=\"400\" />")
    // Get description
    infoWin.document.write("<p style=\"color:#000000;font-family:Arial,Helvetica,sans-serif;font-size:14px;\">" + Description + "</p>")
    infoWin.document.write("</body>")
    infoWin.document.write("</html>")

    infoWin.document.close()

    infoWin.focus()

    return false;
}