function formcheck(){
	for(i=0;i<arguments.length;i++){
		sValue=arguments[i].value;
		sType=arguments[i].type;
		sName=arguments[i].name;
		if((sType=="text" || sType=="textarea")&&(sValue=="")){
			alert("Pami&#281;taj aby wype&#322;ni&#263; wszystkie wolne linijki oznaczone kolorem czerwonym.");
			arguments[i].focus();
			return false;
		}
		if((arguments[i].length != undefined)){
			var list = arguments[i];
			var anyChecked = false;

			for (j=0; j<list.length;j++) {
				if (list[j].checked) anyChecked = true;
			}
			if(anyChecked==false){
				alert("Pami&#281;taj aby wybra&#263; przynajmniej jedn&#261; odpowied&#378; oznaczon&#261; kolorem czerwonym"); 
				return false;
			}
		}
	}

return true;
}

function emailCheck( str )
{
	if ( !validateEmail( str ) )
	{
		alert("Not a valid e-mail!");
		return false;
	}
	else
		return true;
}

function integerCheck( str )
{
	if ( !isInteger( str ) )
	{
		alert("Zip code has to be numeric!");
		return false;
	}
	else
		return true;
}


function validateEmail( strValue) 
{
	var pattern  = /^[a-z0-9]([a-z0-9_\-\.]*)@([a-z0-9_\-\.]*)(\.[a-z]{2,4}(\.[a-z]{2}){0,2})$/i;
 
  	return pattern.test(strValue);
}

function isInteger ( str )
{
	var pattern = /^\d+$/;
	
	return pattern.test ( str );
}


function movecheckedtoinput(inchk, inp) {
	ou = "";
	//var chk = document.all.item(inchk);
	//var chk = frm.item(inchk);
	var chk = document.form1.butiksjob;
	
	//form1
	if (chk != null) {
		if (chk.length == undefined) {
			if (chk.checked) ou = ou + chk.value;
		} else {
			for (i=0; i<chk.length;i++) {
				if (chk[i].checked) {
					if (ou > "") ou = ou + ",";
					ou = ou + chk[i].value;
				}
			}
		}
	}
	inp.value = ou;
}

function popUp(file,strWidth,strHeight) {
	popup = window.open(file,'popup','resizable=1,scrollbars,width='+strWidth+',height='+strHeight+'');
	popup.window.focus();
}

/*
simpleTip for jQuery
By Bj&#246;rn Rixman, Kraftvaerk 2008
Feel free to modify and redistribute with credit.

- displays the title attribute of an element in a styled tooltip.
*/
(function($) {

					
	$.fn.simpleTip = function(options) {
			
		var opts = $.extend({}, $.fn.simpleTip.defaults, options);
		
		if($('#simpleTipWrap').length==0){
			$("body").append(
				'<div id="simpleTipWrap" class="simpleTipWrap"><div class="simpleTipTop"></div>'
				+'<div class="simpleTipMid" id="simpleTipText">'
				+'</div>'
				+'<div class="simpleTipBtm"></div></div>'
			);
		}

			
		$(this).each(function(){
			$(this).hover(
				function(e) {
					this.tip = this.title;
					this.title = "";
					$("#simpleTipText").text(this.tip);
					$tip = $('#simpleTipWrap');
					$tip.css({left:e.pageX-10, top: e.pageY-$tip.height()-10, opacity:0.9 }).fadeIn(200);
					if(opts.follow){
						$(this).mousemove(function(e){
							$tip.css({left:e.pageX-10, top: e.pageY-$tip.height()-10});
					    });
					}
				},
				function() {
					this.title = this.tip;
					$(this).unbind('mousemove')
					//$tip.remove();
					$('#simpleTipWrap').hide();
				}
			);
		})
	}
	$.fn.simpleTip.defaults = {
		id: 'simpleTipWrap',
		follow:true
	};
})(jQuery);

