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 switchAnswer(divname)
{
	if($(divname).style.display == 'none' || $(divname).style.display == '')
		$(divname).style.display = 'block';
	else
		$(divname).style.display = 'none';
	
	app.interfaceController.resizeWindow();

}

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, div, img { margin: 0; padding: 0; border: 0; background-color: #F2F1F1 }</style></head>");
	newWin.document.write("<body><div><img src='" +file+ "' onclick='window.close();' style='border: 0;' alt='"+title+"' /></div>");
	newWin.document.write("</body></html>");
	newWin.focus();
	newWin.document.close();
}

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;
}

function checkform(form)
{
	if (form.Email.value == '' || echeck(form.Email.value) == false)
	{
		alert("Proszę poprawnie wypełnić pole: Email");
		form.Email.focus()
		return false;
	}

	if (form.Fgerg.value.length != 7)
	{
		alert("Proszę poprawnie wypełnić pole: Kod z obrazka");
		form.Fgerg.focus()
		return false;
	}	
	return true;
}

/*  Overlib  */

var ol_textfont = "Arial";
var ol_bgcolor = "#333333"
var ol_textcolor = "#666666";
var ol_fgcolor = "#EEEEEE"
var ol_cap = "Opis programu";
var ol_vauto = "1";
//var ol_hpos = "RIGHT";


