function imageResize(item,x,y){
  if(item){
    var ih=item.height;
    var iw=item.width;
    var ratioW=iw/x;
    var ratioH=ih/y;

    ratioW=iw/x;
    ratioH=ih/y;
    
    if(iw>x){
      iw=x;
      ih=parseInt(ih/ratioW);    
      ratioW=iw/x;
      ratioH=ih/y;
    }
    
    if(ih>y){
      ih=y;
      iw=parseInt(iw/ratioH);
      ratioW=iw/x;
      ratioH=ih/y;
      
      if(iw>x){
        iw=x;
        ih=parseInt(ih/ratioW);
      }
    }    

    //if(iw==0) iw=x;
    if(ih==0) ih=y;

    if(iw!=0) item.width=iw;
    if(ih!=0) item.height=ih;
          
  }
}

function printContent(){
var object = document.getElementById('toPrint')
var object2 = document.getElementById('toPrint2')
var object3 = document.getElementById('toPrint3')
if(object!=null){
  var a = window. open('','','scrollbars=yes,width=700,height=500');
  a.document.open("text/html");
  a.document.write('<html><head><link rel="stylesheet" href="style.css" />'+
                   '</head><style type="text/css">#frame{background-image:none;background-color:#FFFFFF;}</style>'+
                   '<body style="padding-left:10px;background-image:none;background-color:#FFFFFF;">'+
                   '<img src="graphics/sg_logo.png" height="70" border="0" style="float:left;">'+
                   '<div style="color: #434343;font-family:verdana;font-weight:bolder;font-size:18px;float:right;">StudenterGuiden.dk</div><br><br><br><hr>');
  a.document.write(object.innerHTML);
  if(object2!=null)
    a.document.write(object2.innerHTML);
  if(object3!=null)
    a.document.write(object3.innerHTML);
  a.document.write('</body></html>');
  a.document.close();
  a.print();
}
else
  alert('Der er intet at printe på denne side - vælg venligst en indholdsside');
}

function confirmDelete(action,information) {
  var check = window.confirm(information);
  if (check == true) {
    document.location.href = action; 
    return true;
  }
}

function confirmSendMessage(information) {
  var check = window.confirm(information);
  if (check == true) {
    return true;
  }
  return false;
}

function display(myimage) {
 html = '<HTML><HEAD><TITLE>Photo</TITLE></HEAD><BODY LEFTMARGIN=10 MARGINWIDTH=10 TOPMARGIN=10 MARGINHEIGHT=10>'
  + '<table align="center"><tr><td>' 
  + "<IMG SRC='" + myimage + "' BORDER=0 NAME=image " 
  + "onload='window.resizeTo(document.image.width+35,document.image.height+85)' "
  + "onclick='window.close()' >"
  + "</td></tr></table>" 
  + "</BODY></HTML>";
 popup=window.open('','image','height=1,width=1,toolbar=0,location=0,directories=0,menuBar=0,scrollbars=0,status=0,resizable=0');
 popup.document.open();
 popup.document.write(html);
 };
 
function changeFocus(){
  document.getElementById("passwordField").focus();
}

function loginTypeChange(){
	document.getElementById("passwordbox").innerHTML = "<input id=\"passwordField\" class=\"loginInputText\" type=\"password\" name=\"password\" />";
	setTimeout("changeFocus();",100)
}
 
