//<!-- Hide the script
function fixIE6flicker(fix) {
try {
	document.execCommand("BackgroundImageCache", false, fix);
} catch(err) { }

}

window.onload = function() { fixIE6flicker(true); }


 	contactEmailBlur=function(el){ 
        validateEmail();
        if(el.value==''){
            el.value='Your email';
        }
        
    }
	contactEmailFocus=function(el){
        $('submit-contact').disabled = false;  
        if(el.value=='Your email'){ el.value='';	}	
    }





validateEmail=function(){
    
      
    var email=$('mail').value;    
    var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(email)){ 
    
        $('submit-contact').disabled = false;
        $('mailError').innerHTML=''
		$('mailError').style.display='none';
        return true;
	
    }else{
        $('submit-contact').disabled = true;
		$('mailError').style.display='block';
        $('mailError').innerHTML='Please enter valid email'
        return false;
        
    }    
} 



contactSubmit=function(){
    
    if(validateEmail()){
        $('contactForm').submit();
    }
}


function thesame(value1, value2, description)
{
  if (((value1 != null) || 
       (value1 != "")) && 
       value2 != "" && 
       value1 != value2)
  {
       alert("The " + description + " must be identical.");
       return (false);
  }
  return (true);
}


var roll=function(input){
	var scrollDiv=$('scroll-menu');
	scrollDiv.style.background='url(\'img/scroll-bg.jpg\') 0px -'+input+'px';	


}

var confirmNewsDelete=function(formID){

        if (confirm("Are you sure you want to do that?")) { 
            $(formID).submit();            
        }

}


var confirmMailDelete=function(messageID){

        if (confirm("Do you realy want to delete this message?")) { 
        
                window.location='/admin/deletemessage.php?SifM='+messageID;

         }

}

var confirmMlistAction=function(formID){

        if (confirm("Are you sure you want to do that?")) { 
            $(formID).submit();            
        }

}
function SetAllCheckBoxes(FormName, FieldName, CheckValue)
{
        if(!document.forms[FormName])
                return;
        var objCheckBoxes = document.forms[FormName].elements[FieldName];
        if(!objCheckBoxes)
                return;
        var countCheckBoxes = objCheckBoxes.length;
        if(!countCheckBoxes)
                objCheckBoxes.checked = CheckValue;
        else
                // set the check value for all check boxes
                for(var i = 0; i < countCheckBoxes; i++)
                        objCheckBoxes[i].checked = CheckValue;
}

/* ZA Previw SLIKE       */
/***** CUSTOMIZE THESE VARIABLES *****/

  // width to resize large images to
var maxWidth=100;
  // height to resize large images to
var maxHeight=100;
  // valid file types
var fileTypes=["bmp","gif","png","jpg","jpeg"];
  // the id of the preview image tag
var outImage="previewField";
  // what to display when the image is not valid
var defaultPic="spacer.gif";

/***** DO NOT EDIT BELOW *****/

function preview(what){
  var source=what.value;
  var ext=source.substring(source.lastIndexOf(".")+1,source.length).toLowerCase();
  for (var i=0; i<fileTypes.length; i++) if (fileTypes[i]==ext) break;
  globalPic=new Image();
  if (i<fileTypes.length) globalPic.src=source;
  else {
    globalPic.src=defaultPic;
    alert("THAT IS NOT A VALID IMAGE\nPlease load an image with an extention of one of the following:\n\n"+fileTypes.join(", "));
  }
  setTimeout("applyChanges()",200);
}
var globalPic;
function applyChanges(){
  var field=document.getElementById(outImage);
  var x=parseInt(globalPic.width);
  var y=parseInt(globalPic.height);
  if (x>maxWidth) {
    y*=maxWidth/x;
    x=maxWidth;
  }
  if (y>maxHeight) {
    x*=maxHeight/y;
    y=maxHeight;
  }
  field.style.display=(x<1 || y<1)?"none":"";
  field.src=globalPic.src;
  field.width=x;
  field.height=y;
}

function DoPreview()
{
  var filename = document.newad.image.value;
  var Img = new Image();
  if (navigator.appName == "Netscape")
  {
    alert("Previews do not work in Netscape.");
  }
  else
  {
    Img.src = filename;
    document.images[0].src = Img.src;
  }
}
// End -->















