function openImage(image, width, height)
{
    popup = window.open(image,"","width="+(width+17)+",height="+height+",toolbar=0,resizable=0,directories=0,status=0,menubar=0,scrollbars=1");
    popup.focus();
    popup.document.write("<html>");
    popup.document.write("<head><title>Image</title></head>");
    popup.document.write("<body marginwidth=0 marginheight=0 leftmargin=0 topmargin=0>");
    popup.document.write("<table border=0 height=100% align=center cellspacing=0 cellpadding=0><tr><td valign=middle>");
    popup.document.write("<img src='"+image+"' width="+width+" height="+height+">");
    popup.document.write("</td></tr></table>");
    popup.document.write("</body></html>");
    popup.document.close();
}

function check_email(e) {
    ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
	
    for(i=0; i < e.length ;i++){
        if(ok.indexOf(e.charAt(i))<0){ 
        return (false);
        }  
    }

    if (document.images) {
        re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
        re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
        if (!e.match(re) && e.match(re_two)) {
            return (-1);    
        }
    }
}

function Trim(TRIM_VALUE){
if(TRIM_VALUE.length < 1){
return"";
}
TRIM_VALUE = RTrim(TRIM_VALUE);
TRIM_VALUE = LTrim(TRIM_VALUE);
if(TRIM_VALUE==""){
return "";
}
else{
return TRIM_VALUE;
}
} //End Function

function RTrim(VALUE){
var w_space = String.fromCharCode(32);
var v_length = VALUE.length;
var strTemp = "";
if(v_length < 0){
return"";
}
var iTemp = v_length -1;

while(iTemp > -1){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(0,iTemp +1);
break;
}
iTemp = iTemp-1;

} //End While
return strTemp;

} //End Function

function LTrim(VALUE){
var w_space = String.fromCharCode(32);
if(v_length < 1){
return"";
}
var v_length = VALUE.length;
var strTemp = "";

var iTemp = 0;

while(iTemp < v_length){
if(VALUE.charAt(iTemp) == w_space){
}
else{
strTemp = VALUE.substring(iTemp,v_length);
break;
}
iTemp = iTemp + 1;
} //End While
return strTemp;
} //End Function

function checkF()
{
	if(window.top == window)
		return;
	
	window.location.href = "frame.php";
//    popup = window.open(window.location);
//    popup.focus();
}