function popup(url)
{
window.open(url, "_blank", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=no,scrolling=no, resizable=no,directories=no,location=no,width=620, height=630");
}

function info(url)
{
window.open(url, "_blank", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,scrolling=yes, resizable=yes,directories=no,location=no,width=620, height=605");
}
function popup1(url)
{
window.open(url, "_blank", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=no,scrolling=no, resizable=no,directories=no,location=no,width=300,height=300");
}


function contact(url)
{

window.open(url, "_blank", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,scrolling=yes, resizable=yes,directories=no,location=no,width=618,height=670");
}
function quicklinks(url)
{
window.open(url, "_blank", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,scrolling=yes, resizable=yes,directories=no,location=no,width=700,height=500");
}

function feed(url)
{
window.open(url, "_blank", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,scrolling=yes, resizable=yes,directories=no,location=no,width=600,height=400");
}

function delivery(url)
{
window.open(url, "_blank", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,scrolling=yes, resizable=yes,directories=no,location=no,width=700,height=600");
}


function qlinks(url,w,h)
{
if(w==null) w=700;
if(h==null) h=600;
window.open(url, "_blank", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,scrolling=yes, resizable=yes,directories=no,location=no,width=700,height=600");
}

function order(url,w,h)
{
if(w==null) w=800;
if(h==null) h=600;
window.open(url, "_blank", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,scrolling=yes, resizable=yes,directories=no,location=no,width=800,height=600");
}
function largeview(url)
{
window.open(url, "_blank", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=no,scrolling=no, resizable=no,directories=no,location=no, width=370, height=360");
}

function tf(url)
{
window.open(url, "_blank", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=no,scrolling=no, resizable=no,directories=no,location=no, width=251, height=274 , left = 400, top = 100");
}

function dmlogin(url)
{
//window.close();
window.open(url, "_blank", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=no,scrolling=no, resizable=no,directories=no,location=no, width=500, height=251");
//window.close();
}

function dreamMachine(url)
{
window.open(url, "_blank", "fullscreen=no,toolbar=no,status=no,menubar=no,scrollbars=yes,scrolling=yes, resizable=yes,directories=no,location=no,width=800,height=600");
}

function getElementPosition(elemID) {var offsetTrail = document.getElementById(elemID);var offsetLeft = 0;var offsetTop = 0;while (offsetTrail) {offsetLeft += offsetTrail.offsetLeft;offsetTop += offsetTrail.offsetTop;offsetTrail = offsetTrail.offsetParent;}if (navigator.userAgent.indexOf("Mac") != -1 && typeof document.body.leftMargin != "undefined") {offsetLeft += document.body.leftMargin;offsetTop += document.body.topMargin;} return {left:offsetLeft, top:offsetTop};}


function prepareToOpenPreviewPic(imageName,theid) 
{
document.getElementById('picpreviewimg').src=imageName;
document.getElementById('picpreview').style.top  = getElementPosition(theid).top-15;
document.getElementById('picpreview').style.left = getElementPosition(theid).left+260;
document.getElementById('picpreview').style.visibility = 'visible';
}

function closePreviewPic()
 {
 
 document.getElementById('picpreview').style.visibility = 'hidden';
 document.getElementById('picpreviewimg').src="D:\span.gif"
 }
 
 function emailCheck (emailStr) {

var emailPat=/^(.+)@(.+)$/

var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"

var validChars="\[^\\s" + specialChars + "\]"

var quotedUser="(\"[^\"]*\")"

var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/

var atom=validChars + '+'

var word="(" + atom + "|" + quotedUser + ")"
var userPat=new RegExp("^" + word + "(\\." + word + ")*$")
var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")
var matchArray=emailStr.match(emailPat)

        if (matchArray==null) {
          
                return false
        }
        var user=matchArray[1]
        var domain=matchArray[2]

       
        if (user.match(userPat)==null) {

            return false
        }

    
        var IPArray=domain.match(ipDomainPat)
        if (IPArray!=null) {
          
                  for (var i=1;i<=4;i++) {
                    if (IPArray[i]>255) {
                        return false
                    }
            }
            return true
        }

        var domainArray=domain.match(domainPat)
        if (domainArray==null) {
            return false
        }

        var atomPat=new RegExp(atom,"g")
        var domArr=domain.match(atomPat)
        var len=domArr.length
        if (domArr[domArr.length-1].length<2 ||
            domArr[domArr.length-1].length>3) {

           return false
        }

      
        if (len<2) {

           return false
        }

       
        return true;
}

function lTrim(str)        {
var space
space = 0
if (str.length == 0)
        return str

        for (i=0;i<=str.length-1;i++)        {
                if (escape(str.charAt(i))==escape(" "))
                        space++
                else
                        break
        }
        if (space > 0)
                str = str.substring(space, str.length)

return str
}


function LoginFRM_onSubmit(prmFRM)        {

var prmLoginName, prmpassword
var errors
errors = " "

prmEmail = lTrim(prmFRM.Email.value)
prmPassword = lTrim(prmFRM.Password.value)

if (prmEmail.length < 1)
        errors = errors + " Email is required\n"
else
        if (!emailCheck(prmEmail))
                errors = errors + "Invaid Email Address\n"

if (prmPassword.length < 1)
        errors = errors + " Password is required\n"

if (errors.length > 1)        {
        alert(lTrim(errors))
        return false
}
return true
}

function subscribeFRM_onSubmit(prmFRM)        {

var errors
errors = " "
prmEmail = lTrim(prmFRM.email.value)


if (prmEmail.length < 1)
        errors = errors + " Email is required\n"
else
        if (!emailCheck(prmEmail))
                errors = errors + "Invaid Email Address\n"
if (errors.length > 1)        {
        alert(lTrim(errors))
        return false
}
return true
}

function right(e) 
{
if (navigator.appName == 'Netscape' && (e.which == 3 || e.which == 2)) return false;
else if (navigator.appName == 'Microsoft Internet Explorer' && (event.button == 2 || event.button == 3)) {
alert('  This Page is fully protected \r © Copyright CTI Technology Ltd.');
return false;
}

return true;
}
/*
document.onmousedown=right;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
window.onmousedown=right;
*/