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 change_img(id,img){
  document.getElementById(id).src=img
}
function change_img_obj(obj,img){
  obj.src=img
}
function fixit(){
  document.getElementById('fixit_url_id').value = document.location;
  errors=0;
  if(document.getElementById('fixit_podpis_id').value==''){
    errors++;
  }
  if(document.getElementById('fixit_tresc_id').value==''){
    errors++;
  }
  if(!errors){
    alert('Dziękujemy!');
    document.fixit_form.submit();
  }else{
    alert('Sprawdź poprawność formularza');
  }
}
function friendit(){
  document.getElementById('friendit_url_id').value = document.location;
  errors=0;
  if(!echeck(document.getElementById('friendit_adresat_email_id').value)){
    errors++;
  }
  if(!echeck(document.getElementById('friendit_mail_id').value) && document.getElementById('friendit_mail_id').value!=''){
    errors++;
  }
  if(document.getElementById('friendit_adresat_id').value==''){
    errors++;
  }
  if(document.getElementById('friendit_imie_id').value==''){
    errors++;
  }
  if(document.getElementById('friendit_komentarz_id').value==''){
    errors++;
  }
  if(!errors){
    alert('Dziękujemy!');
    document.friendit_form.submit();
  }else{
    alert('Sprawdź poprawność formularza');
  }
}

function show_fixit(){
  if(typeof(window.pageYOffset)=='number'){
    scrOfY = window.pageYOffset;
  }else if(document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    scrOfY = document.body.scrollTop;
  }else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)){
    scrOfY = document.documentElement.scrollTop;
  }
  document.getElementById('fixit').style.top = 100+scrOfY+"px";
  document.getElementById('fixit').style.display = 'block';
  mint.gui.RegisterDragObject('fixit');
}
function hide_fixit(){
  document.getElementById('fixit').style.display='none';
}


function show_powiadom(){
  if(typeof(window.pageYOffset)=='number'){
    scrOfY = window.pageYOffset;
  }else if(document.body && ( document.body.scrollLeft || document.body.scrollTop ) ) {
    scrOfY = document.body.scrollTop;
  }else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)){
    scrOfY = document.documentElement.scrollTop;
  }
  document.getElementById('powiadom').style.top = 100+scrOfY+"px";
  document.getElementById('powiadom').style.display = 'block';
  mint.gui.RegisterDragObject('powiadom');
}
function hide_powiadom(){
  document.getElementById('powiadom').style.display='none';
}
