// joker@joker.art.pl
// la_mo_16.06.06

var $j = jQuery.noConflict();
     var test=1
     // Use jQuery via $j(...)
	 function grow(){
		 //alert('aa0')
		 $j("#pageflip img , .msg_block")
			.animate({
				width: '55px'
			}, 600,'',function(){
			$j("#pageflip img , .msg_block")
			.animate({
				width: '50px' 
			}, 200);
			grow()
			});
			
	 }

     $j(document).ready(function(){
       $j("#pageflip").hover(function() {
		   //alert(test)
		$j("#pageflip img , .msg_block").clearQueue();
		$j("#pageflip img , .msg_block").stop()
			.animate({
				width: '307px', 
				height: '319px'
			}, 500); 
		} , function() {
		$j("#pageflip img").stop() 
			.animate({
				width: '50px', 
				height: '52px'
			}, 220);
		$j(".msg_block").stop() 
			.animate({
				width: '50px', 
				height: '50px'
			}, 200);
	});
	grow();
     });
     
     


photowindow_op = null;

function photowindow(url, nazwa, width, height){
  if (photowindow_op) photowindow_op.close();
  width += 18;
  height += 18;
	params = "status=no, statusbar=no, menubar=no, scrollbars=no, resizeable=yes, toolbar=no, location=no, directories=no, left=20, top=20, width=" + width + ", height=" + height;	
  photowindow_op = window.open(url, 'photobig', params);
  photowindow_op.focus();
}


function check(url, co) {
	if (confirm(co)) { 
		window.location.replace(url); 
	} else { 
		return false;
	}
}


function checksubmit(a, co) {
	if (confirm(co)) { 
		a.submit(); 
	} else { 
		return false;
	}
}


function io_onchange(foremka, aa, bb) {
	arr=new Array();
	if (bb.match(',')) arr=bb.split(',');
	else arr.push(bb);
	for (i=0; i<arr.length; i++) {
		if (aa.checked) {
			foremka.elements[arr[i]].disabled=true;
		} else {
			foremka.elements[arr[i]].disabled=false;
		}
	}
}


function openDialogWin(file,name) {
	if (arguments.length>=3) {
		ww=arguments[2]
	} else {
		ww=500;
	}
	if (arguments.length==4) {
		wh=arguments[3]
	} else {
		wh=400;
	}
	leftnw = (window.screen.availWidth - ww )/2;
	topnw = (window.screen.availHeight - wh)/2;
	window.open(file,name, 'toolbar=no,status=no,resizable=yes,scrollbars=yes,scrollable=yes,dependent=yes,top='+topnw+',left='+leftnw+',width='+ww+',height='+wh);
}

function openDialogWinFB(file,name) {
		ww=600;
		wh=400;
	leftnw = (window.screen.availWidth - ww )/2;
	topnw = (window.screen.availHeight - wh)/2;
	window.open(file,name, 'toolbar=no,status=yes,resizable=no,scrollbars=no,scrollable=no,dependent=yes,top='+topnw+',left='+leftnw+',width='+ww+',height='+wh);
}

function openOutFile(file,name) {
	window.open(file,name, 'scrollbars=yes, resizeable=yes, width=600, height=500');
}

function outFileSetSelect(id,val) {
	opener.document.getElementById(id).value=val;
	window.close();
}

function jform_collapse(idel, a, b) {
	ob = document.getElementById(idel);
	img = document.getElementById('jform_collapse_img_'+idel);
	if (ob.style.height==b+'px') {
		ob.style.height=a+'px';
		img.src='gfx/up.gif';
	} else {
		ob.style.height=b+'px';
		img.src='gfx/down.gif';
	}
}

function rel1n_sel(fid, fidv, fs, fsv) {
	opener.document.getElementById(fid).value=fidv;
	opener.document.getElementById(fs).value=fsv;
	window.close();
}

function winjs_url(wtitle, ww,wh, wt, wl, wurl) {

	if (wt==0) {
		wl = (window.screen.availWidth - ww )/2;
		wt = (window.screen.availHeight - wh)/2 -80;
	}
	
	wname = 'nw1'+Math.random();
	win = new Window(wname, {title: wtitle, opacity: 0.95, width:ww, height:wh, top:wt, left:wl, showEffect:Element.show, hideEffect: Effect.SwitchOff, maximizable:true, minimizable:true, closable:true, resizable:true, url: wurl});   
	win.setDestroyOnClose();
	win.show();
}

function winjs_txt(wtitle, ww, wh, wt, wl, wtxt) {
	if (wt==0) {
		wl = (window.screen.availWidth - ww)/2;
		wt = (window.screen.availHeight - wh)/2-80;
	}
	wname = 'nw1'+Math.random();
	win = new Window(wname, {title: wtitle, opacity: 0.95, showEffect:Element.show, hideEffect: Effect.SwitchOff, width:ww, height:wh, top:wt, left:wl, maximizable:true, minimizable:true, closable:true, resizable:true});   
	win.getContent().innerHTML=wtxt;
	win.setDestroyOnClose();
	win.show();
}

function winjs_pure_url(wtitle, ww, wh, wt, wl, wurl) {
	if (wt==0) {
		wl = (window.screen.availWidth - ww )/2;
		wt = (window.screen.availHeight - wh)/2-80;
	}
	wname = 'nw1'+Math.random();
	win = new Window(wname, {title: wtitle, opacity: 0.95, showEffect:Element.show, hideEffect: Effect.SwitchOff, width:ww, height:wh, top:wt, left:wl, maximizable:false, minimizable:false, closable:true, resizable:false, url: wurl});   
	win.setDestroyOnClose();
	win.show();
}

function winjs_pure_txt(wtitle, ww,wh, wt, wl, wtxt) {
	if (wt==0) {
		wl = (window.screen.availWidth - ww )/2;
		wt = (window.screen.availHeight - wh)/2-80;
	}
	wname = 'nw1'+Math.random();
	win = new Window(wname, {title: wtitle, opacity: 0.95, showEffect:Element.show, hideEffect: Effect.SwitchOff, width:ww, height:wh, top:wt, left:wl, maximizable:false, minimizable:false, closable:true, resizable:false});   
	win.setDestroyOnClose();
	win.getContent().innerHTML=wtxt;
	win.show();
}

function setCookie(cookieName,cookieValue,nSec) {
 var today = new Date();
 var expire = new Date();
 if (nSec==null || nSec==0) nSec=3600;
 expire.setTime(today.getTime() + 1000*nSec);
 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}


function collapseGroup(elementid) {
	el=document.getElementById(elementid);
	
	mainelid = el.getAttribute('CONNECT');
	mainel = document.getElementById(mainelid);
	imgon = el.getAttribute('ONACTIVE');
	imgoff = el.getAttribute('ONUNACTIVE');
	imagecollapse = document.getElementById(elementid+'_cimg');
	if (mainel.style.display=='none') {
		setCookie(elementid,'on',3600);
		mainel.style.display='block';
		imagecollapse.src=imgon;
	} else {
		setCookie(elementid,'off',3600);
		mainel.style.display='none';
		imagecollapse.src=imgoff;
	}
}

function collapseElement(elementid) {
	el=document.getElementById(elementid);
	
	if (el.style.display=='none') {
		el.style.display='block';
	} else {
		el.style.display='none';
	}
}

function jdbet_chpass(crypto, dest, src1, src2) {
	
	s1=document.getElementById(src1).value;
	s2=document.getElementById(src2).value;

	if (s1==s2 & s1!='') {
		if (crypto=='md5')
			opener.document.getElementById(dest).value=hex_md5(s1);
		else 
			opener.document.getElementById(dest).value=s1;
		window.close();
	} else if (s1=='') {
		alert('Hasło nie może być puste');
		return false;
	} else if (s1!=s2) {
		alert('Hasło i powtórzenie nie zgadzają się!');
		return false;
	} 
	
}


function rf_up() {
	if ($F('pass1') != $F('pass2')) {
		alert('Hasło i powtórzenie muszą być identyczne!');
		return false;
	} else if ($F('pass1').length<5) {
		alert('Hasło musi się składać z minimum 5 znaków!');
		return false;
	}
	return true;
}

function rf_ue() {
	var valid = /^[0-9a-z]+([\.\-_][0-9a-z]+)*\@[0-9a-z]+([\.\-][0-9a-z]+)*\.(([a-z]{2,4}))$/;
	var emailfield = $F('email');
	if (!emailfield.match(valid)) {
		alert('Niepoprawny format adresu e-mail');
		return false;
	} else return true;
}

function rf_ud() {
	if ($F('imie').length<2) {
		alert('Wpełnij prawidłowo pole Imię!');
		return false;
	}
	if ($F('nazwisko').length<2) {
		alert('Wpełnij prawidłowo pole Nazwisko!');
		return false;
	}
	if ($F('ulica').length<2) {
		alert('Wpełnij prawidłowo pole Ulica!');
		return false;
	}
	if ($F('nr_domu')=='') {
		alert('Wpełnij prawidłowo pole Numer domu!');
		return false;
	}
	if ($F('kod').length<5) {
		alert('Wpełnij prawidłowo pole Kod pocztowy!');
		return false;
	}
	if ($F('miejscowosc').length<2) {
		alert('Wpełnij prawidłowo pole Miejscowość!');
		return false;
	}
	if ($F('wojewodztwo').length<2) {
		alert('Wpełnij prawidłowo pole Województwo!');
		return false;
	}
	if ($F('telefon').length<6) {
		alert('Wpełnij prawidłowo pole Telefon!');
		return false;
	}
	return true;

}
