function nRand(_100){
today=new Date();
seed=today.getTime();
seed=(seed*9301+49297)%233280;
seed=seed/(233280);
return Math.ceil(seed*_100);
}
function popUp(path,w,h){
var t=(screen.height/2)-(h/2)-50;
var l=(screen.width/2)-(w/2);
var _106="location=no,scrollbars=no,menubars=no,toolbars=no,resizable=no, left="+l+",top="+t+",width="+w+",height="+h;
popwin=window.open(path,"pop"+nRand(100),_106);
popwin.focus();
}
function popUpScroll(path,w,h){
var t=(screen.height/2)-(h/2)-50;
var l=(screen.width/2)-(w/2);
var _10c="location=no,scrollbars=yes,menubars=no,toolbars=no,resizable=yes, left="+l+",top="+t+",width="+w+",height="+h;
popwin=window.open(path,"pop"+nRand(100),_10c);
popwin.focus();
}

function popimg(imgURL) {

var popImg = new Image();
popImg.src = imgURL;
window.setTimeout(chkimg(popImg),100);
}

function chkimg(popImg)
{
  if (popImg.width==0) {
    //window.setTimeout(chkimg(popImg),100)
    return
  }
  //alert(popImg.width);
  popUpImg(popImg.src, popImg.width+2, popImg.height+2);
}

function popUpImg(path,w,h){
var t=(screen.height/2)-(h/2)-50;
var l=(screen.width/2)-(w/2);
var _10c="location=no,scrollbars=no,menubars=no,toolbars=no,resizable=no,location=no,directories=no,status=no,left="+l+",top="+t+",width="+w+",height="+h;
popwin=window.open(path,"pop"+nRand(100),_10c);
popwin.focus();
}

function checkinput(input, text)
{
  if (input.value == "") {
    alert(text);
    input.focus();
    return false ;
  }
  return true ;
}

var prevImg;
function popupPreview (url,w,h){
var prop="width="+w+",height="+h+",top=50,left=50,titlebar=no,location=no,fullscreen=no,scrollbars=no,menubar=no,toolbar=no"
prevImg = window.open (url,"previewImg", prop);
}