
function loginUser(login, password, videoBoxLayer)
{
    // if length of login and password values are greater then zero.   
    if (login.value.length > 0 && password.value.length > 0)
    {
//        alert(login.value);
//        alert(password.value);
    
        if (videoBoxLayer)
            window.parent.location = '/Default.aspx?login=' + login.value + '&password=' + password.value;
        else
            window.location = '/Default.aspx?login=' + login.value + '&password=' + password.value;                
    }
    
    return false  
}

function showPopUp(URL,Title,Width,Height,Params)
	{
	var WL,WT;  // window left, window top	
	
	if (showPopUp.arguments.length == 0)
		{return false;}
		
	if (showPopUp.arguments.length == 4)
		{Params = '';}
	
	if (Params == '')
		{Params = 'toolbar=no,resizable=yes,scrollbars=yes';}
		
	if (showPopUp.arguments.length == 3)
		{Height = 0;}
		
	if (Height == 0)
		{Height = 700;}
		
	if (showPopUp.arguments.length == 2)
		{Width = 0;}
		
	if (Width == 0)
		{Width = 550;}
		
	if (showPopUp.arguments.length == 1)
		{Title = '';}
		
	if (Title == '')
		{Title = 'ShowPopUp' + Math.round(999*Math.random());}
	
	WL = Math.ceil((screen.availWidth-Width)/2);
	WT = Math.ceil((screen.availHeight-Height)/2);
	
	// makes the window a little bigger than the picture since the window has some auto padding/margin thing going on
	Height += 40;
	Width += 40;
	
	newwindow = window.open(URL,Title,Params + ",height=" + Height + ",width=" + Width + ",left=" + WL + ",top=" + WT);
		
	if (window.focus)
		{newwindow.focus();}
	
	return false;
	}
	
	

	var offsetfrommouse=[10,10]; //image x,y offsets from cursor position in pixels. Enter 0,0 for no offset
	var displayduration=0; //duration in seconds image should remain visible. 0 for always.
	var currentimageheight = 120;	// maximum image size.

	if (document.getElementById || document.all){
		document.write('<div id="previewimageid">');
		document.write('</div>');
	}

	function getpreviewobj(){
	if (document.getElementById)
	return document.getElementById("previewimageid").style
	else if (document.all)
	return document.all.previewimageid.style
	}

	function getpreviewobjnostyle(){
	if (document.getElementById)
	return document.getElementById("previewimageid")
	else if (document.all)
	return document.all.previewimageid
	}

	function truebody(){
	return (!window.opera && document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
	}
	function showpreview(title,description){
		currentimageheight = 120;

		document.onmousemove=followmouse;

		newHTML = '<dl>';
		newHTML = newHTML + '<dt>' + title + '</dt>';
		newHTML = newHTML + '<dd>' + description + '</dd>';
		newHtml = newHTML + '</dl>'
		getpreviewobjnostyle().innerHTML = newHTML;
		getpreviewobj().visibility="visible";
	}
	function hidepreview(){
		getpreviewobj().visibility="hidden"
		document.onmousemove=""
		getpreviewobj().left="-500px"
	}

	function followmouse(e){
		var xcoord=offsetfrommouse[0]
		var ycoord=offsetfrommouse[1]

		var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
		var docheight=document.all? Math.min(truebody().scrollHeight, truebody().clientHeight) : Math.min(window.innerHeight)

		//if (document.all){
		//	getpreviewobjnostyle().innerHTML = 'A = ' + truebody().scrollHeight + '<br />B = ' + truebody().clientHeight;
		//} else {
		//	getpreviewobjnostyle().innerHTML = 'C = ' + document.body.offsetHeight + '<br />D = ' + window.innerHeight;
		//}

		if (typeof e != "undefined"){
			if (docwidth - e.pageX < 150){
				xcoord = e.pageX - xcoord - 220; // Move to the left side of the cursor
			} else {
				xcoord += e.pageX;
			}
			if (docheight - e.pageY < (currentimageheight + 30)){
				ycoord += e.pageY - Math.max(0,(30 + currentimageheight + e.pageY - docheight - truebody().scrollTop));
			} else {
				ycoord += e.pageY;
			}

		} else if (typeof window.event != "undefined"){
			if (docwidth - event.clientX < 150){
				xcoord = event.clientX + truebody().scrollLeft - xcoord - 220; // Move to the left side of the cursor
			} else {
				xcoord += truebody().scrollLeft+event.clientX
			}
			if (docheight - event.clientY < (currentimageheight + 30)){
				ycoord += event.clientY + truebody().scrollTop - Math.max(0,(30 + currentimageheight + event.clientY - docheight));
			} else {
				ycoord += truebody().scrollTop + event.clientY;
			}
		}

		var docwidth=document.all? truebody().scrollLeft+truebody().clientWidth : pageXOffset+window.innerWidth-15
		var docheight=document.all? Math.max(truebody().scrollHeight, truebody().clientHeight) : Math.max(document.body.offsetHeight, window.innerHeight)
			if(ycoord < 0) { ycoord = ycoord*-1; }
		getpreviewobj().left=xcoord+"px"
		getpreviewobj().top=ycoord+"px"

	}