function swithLogVis()
{
	if($('LogBox').style.display == 'none' || $('LogBox').style.display == '')
		$('LogBox').style.display = 'block';
	else
		$('LogBox').style.display = 'none';

}

function addFlashObject(fileURL, objName, width, height, targetTag)
{
    var o_Flash = $(targetTag);
    
    o_Flash.innerHTML = '<object id = "' + objName + '" width = "' + width + 'px" height = "' + height + 'px" classid = "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase = "http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0">'
                      + '    <param name = "allowScriptAccess" value = "sameDomain" />'
                      + '    <param name = "movie" value="' + fileURL + '" />'
                      + '    <param name = "loop" value="false" />'
                      + '    <param name = "menu" value="false" />'
                      + '    <param name = "quality" value="high" />'
                      + '    <embed name = "' + objName + '" src = "' + fileURL + '" swLiveConnect = "true" loop = "false" menu = "false" quality = "best" allowScriptAccess = "sameDomain" width = "' + width + 'px" height = "' + height + 'px" allowScriptAccess = "sameDomain" type = "application/x-shockwave-flash" pluginspage = "http://www.macromedia.com/go/getflashplayer"></embed>'
                      + ' </object>';
}

function getOffset(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 {left: curleft, top: curtop};
}

function winOpen(file,title,w,h)
{
     
	var look = '';
	var sbars = 0;
	var resize = 0;

	if(w > screen.availWidth)
	{
		w = screen.availWidth-30;
		sbars = 0;
		resize = 1;
	}
	if(h > screen.availHeight)
	{
		h = screen.availHeight-60;
		sbars = 0;
		resize = 1;
	}

	if(typeof(newWin)=='object')
	{
		if(newWin.closed);
		else
		{
			newWin.resizeTo(w, h);
		}
	}
	
	xpos = (screen.availWidth / 2)-(w / 2);
  	ypos = (screen.availHeight / 2)-(h / 2);

 	look = 'scrollbars='+sbars+', resizable='+resize+', width='+w+',height='+h+', left='+xpos+', top='+ypos;
    newWin = window.open(file,'newWinodow','toolbar=0,statusbar=0,location=0,'+look);
	newWin.document.write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\"><html><head><title>"+title+"</title><style type = \"text/css\">body, html { margin: 0; padding: 0; border: 0; background-color: #F2F1F1 }</style></head>");
	newWin.document.write("<body><img src='" +file+ "' onClick='window.close();' border=0 alt='"+title+"' />");
	newWin.document.write("</body></html>");
	newWin.focus();
	newWin.document.close();
}

function LicencjaOpen(file,w)
{
	var title = 'Umowa Licencyjna';
	var look = '';
	var sbars = 1;
	var resize = 0;
	h = (screen.height - 250);

	if(typeof(newWin)=='object')
	{
		if(newWin.closed);
		else
		{
			newWin.resizeTo(w, h);
		}
	}
	
	xpos = (screen.width / 2)-(w / 2);
  	ypos = (screen.height / 2)-(h / 2) - 30;

 	look = 'scrollbars='+sbars+', resizable='+resize+', width='+w+',height='+h+', left='+xpos+', top='+ypos;
    newWin = window.open(file,'newWinodow','toolbar=0,statusbar=0,location=0,'+look);
	newWin.focus();
}

function echeck(str) 
{

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){

		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){

		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){

		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){

		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){

		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){

		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){

		    return false
		 }

 		 return true;
}