var window_w;
var window_h;

function UploadFile(f) {
  if (f.userfile.value == '')
    {
      alert("You didn\'t select any file to upload yet.");
      return false;
    } else {
	document.getElementById('path').value = f.userfile.value; 
	document.getElementById('select_file').style.visibility="hidden";
	document.getElementById('uploading').style.visibility="visible";
	return true;
    }
}
function sendemail(f) {
var
f_e=f.f_email.value;
t_e=f.t_email.value;
  f.f_email.style.backgroundColor="#FFFFFF";
	f.t_email.style.backgroundColor="#FFFFFF";
if (f_e.indexOf('@') == -1)
    {
      alert('Please input a valid email address!');
	f.f_email.style.backgroundColor="#FFCC00";
      return false;
    } else if(t_e.indexOf('@') == -1)
    {
      alert('Please input a valid email address!');
	f.t_email.style.backgroundColor="#FFCC00";
      return false;
    } else {
	f.submit.disabled = true;
	f.submit.value = 'Sending...';
    }
}
function addbookmark()
{
    var nome_sito = "Inspic - Photo upload tool";
    var url_sito = "http://inspic.com/?r=bookmark";
    if ((navigator.appName == "Microsoft Internet Explorer") && (parseInt
        (navigator.appVersion) >= 4))
        window.external.AddFavorite(url_sito, nome_sito);
    else if (navigator.appName == "Netscape")
        window.sidebar.addPanel(nome_sito, url_sito, '');
    else
        alert("Sorry! Can't add this site to your favorite!");
}

function GetWindowSize(){
if (document.documentElement && document.documentElement.clientHeight)
{  // Explorer 6 Strict Mode 
window_w = document.documentElement.clientWidth;
window_h = document.documentElement.clientHeight;
}
else if (document.body)
{ // other Explorers 
window_w = document.body.clientWidth;
window_h = document.body.clientHeight;
}
else if (self.innerHeight) 
{// all except Explorer 
window_w = self.innerWidth; 
window_h = self.innerHeight; 
}
}

function FillInBody(){
var NS = (navigator.appName=="Netscape")?true:false;
window.onresize=FillInBody;
GetWindowSize();
var i=5;
if (NS) i=document.documentElement.offsetHeight
else{
i+=document.body.offsetTop;
i+=document.body.offsetHeight;
}
if (window_h>i){
var h=window_h-i;
h+=document.getElementById("content").offsetHeight;
document.getElementById("content").style.height=h+"px";
}
}

function CenterElement(ObjID){
GetWindowSize();
var Obj=document.getElementById(ObjID);
var w=Obj.offsetWidth;
var h=Obj.offsetHeight;
var l,t;
l=(w<=window_w)?(window_w-w)/2:0;
t=(h<=window_h)?(window_h-h)/2:0;
Obj.style.left=Math.round(l)+"px";
Obj.style.top=Math.round(t)+"px";
}