﻿
function MM_findObj(n, d) { 
 var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {  d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
 if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function openWindow(url) {
 var width = parseInt(screen.availWidth)-100; var height =parseInt(screen.availHeight)-200;
 var left = parseInt((screen.availWidth/2) - (width/2)); var top = parseInt((screen.availHeight/2) - (height/2)); var windowFeatures = "width=" + width + ",height=" + height + ",status=no,scrollbars=yes,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top; myWindow = window.open(url, "subWind", windowFeatures);
}
 
function openImageWindow(url) {
 var width = parseInt(screen.availWidth)-400; var height =parseInt(screen.availHeight)-300;
 var left = parseInt((screen.availWidth/2) - (width/2)); var top = parseInt((screen.availHeight/2) - (height/2)); var windowFeatures = "width=" + width + ",height=" + height + ",status=no,scrollbars=yes,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top; myWindow = window.open(url, "", windowFeatures);
}

function openVideoWindow(url) {
 var width = 400; var height = 350;
 var left = parseInt((screen.availWidth/2) - (width/2)); var top = parseInt((screen.availHeight/2) - (height/2)); var windowFeatures = "width=" + width + ",height=" + height + ",status=no,scrollbars=no,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top; myWindow = window.open(url, "", windowFeatures);
}

function openSmallWindow(url) {
 var width = parseInt(screen.availWidth)-100; var height =parseInt(screen.availHeight)-300; var left = parseInt((screen.availWidth/2) - (width/2)); var top = parseInt((screen.availHeight/2) - (height/2));
 var windowFeatures = "width=" + width + ",height=" + height + ",status=no,scrollbars=yes,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top; myWindow = window.open(url, "", windowFeatures);
}

function openNewWindow(url) {
 var width = parseInt(screen.availWidth)-100; var height =parseInt(screen.availHeight)-150; var left = parseInt((screen.availWidth/2) - (width/2));
 var top = parseInt((screen.availHeight/2) - (height/2)); var windowFeatures = "width=" + width + ",height=" + height + ",status=no,scrollbars=yes,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top; myWindow = window.open(url, "", windowFeatures);
}

function openNewMediumWindow(url) {
 var width = parseInt(screen.availWidth)-100; var height =parseInt(screen.availHeight)-200; var left = parseInt((screen.availWidth/2) - (width/2));
 var top = parseInt((screen.availHeight/2) - (height/2)); var windowFeatures = "width=" + width + ",height=" + height + ",status=no,scrollbars=yes,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top; myWindow = window.open(url, "", windowFeatures);
}

function openBigWindow(url) {
 var width = parseInt(screen.availWidth)-10; var height =parseInt(screen.availHeight)-50;
 var left = 0; var top = 0; var windowFeatures = "width=" + width + ",height=" + height + ",status=no,scrollbars=yes,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top; myWindow = window.open(url, "subWind", windowFeatures);
}

function openNewBigWindow(url) {
 var width = parseInt(screen.availWidth)-10; var height =parseInt(screen.availHeight)-50;
 var left = 0; var top = 0; var windowFeatures = "width=" + width + ",height=" + height + ",status=no,scrollbars=yes,resizable,left=" + left + ",top=" + top + "screenX=" + left + ",screenY=" + top; myWindow = window.open(url, "", windowFeatures);
}

function confirmDelete(url)
{
 var result= confirm("Do you really want to delete?");
 if(result)
    window.location =url;
}

function isValidNumber(Object){ if (isNaN(Object.value)) {alert("Please enter number only.");    Object.value.length=0; Object.value="";   }  }

function isValidEmail(Object) { var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;   var address = Object.value;   if(reg.test(address) == false) return false; else return true; }

function validateEmail(Object) { var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;   var address = Object.value;   if(reg.test(address) == false) { alert("Please enter valid email."); Object.focus();}}

function setCursorHand(object){ object.style.cursor="pointer";}

function setCursorDefault(object){ object.style.cursor="default"; }

function trim(str) { str = str.replace(/^\s+/, ''); return str.replace(/\s+$/, '');}

function sleep(delay){ var start = new Date().getTime(); while (new Date().getTime() < start + delay);}

function clickIE4(){if (event.button==2){return false;}}function clickNS4(e){if (document.layers||document.getElementById&&!document.all){if (e.which==2||e.which==3){return false;}}}if (document.layers){document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS4;}else if (document.all&&!document.getElementById){document.onmousedown=clickIE4;}document.oncontextmenu=new Function('return false')

function validateText(object)
{
  var chars = "#&<>";
  for (var i = 0; i < object.value.length; i++) {
  if ((chars.indexOf(object.value.charAt(i))) != -1) {  	
    alert ("Following special characters are not allowed:\n     # (hash)\n     & (ampersand)\n     < (less than)\n     > (greater than) \n\nPlease remove them and try again.");
  	object.focus(); object.select(); return false; } }
}

