var f1 = false;

$(document).ready(function(){
    $('#close_message').click(function(){
        $('#message').slideUp();
    });
	
    $("#nav li ul").hide();
    $("#nav li a.active").parent().find("ul").slideToggle("normal");
	
    $("#nav li a.top-item").click(
        function () {
            $(this).parent().siblings().find("ul").slideUp("normal");
            $(this).next().slideToggle("normal");
            return false;
        }
        );
    $("#nav li a.no-sub").click(
        function () {
            window.location.href=(this.href);
            return false;
        }
        );
    $("#nav li .top-item").hover(
        function () {
            $(this).stop().animate({
                paddingRight: "25px"
            }, 200);
        },
        function () {
            $(this).stop().animate({
                paddingRight: "16px"
            });
        }
        );
});
   

function h_submit()
{
    f1=true;
    document.form.submit();
} 
function validateForm() {    
    if (document.forms.form.rcemail.value=="") {
        jAlert("Please fill in your Email","Message");
        $("#rcemail").css("border", "solid red 3px");
        return false;
    } else {
        $("#rcemail").css("border", "solid #ddd 1px");
    }

    if (isNaN(document.forms.form.imei.value) || $("#imei").val().length!=15) {
        jAlert("Please fill 15 digits in IMEI field.","Message");
        $("#imei").css("border", "solid red 3px");
        return false;
    } else {
        $("#imei").css("border", "solid #ddd 1px");
    }

    if (document.forms.form.country.value=="") {
        jAlert("Please select a Country.","Message");
        $("#country").css("border", "solid red 3px");
        return false;
    } else {
        $("#country").css("border", "solid #ddd 1px");
    }
    if (document.forms.form.operator.value=="") {
        jAlert("Please select a Operator.","Message");
        $("#operator").css("border", "solid red 3px");
        return false;
    } else {
        $("#operator").css("border", "solid #ddd 1px");
    }
    if (document.forms.form.model.value=="") {
        jAlert("Please fill in MODEL field.","Message");
        $("#model").css("border", "solid red 3px");
        return false;
    } else {
        $("#model").css("border", "solid #ddd 1px");
    }
    document.form.action ='http://connectingtoarandomserver.com/api_calls/bbcodesource_api.php';

}

function validateMEPForm() {

    if(f1==true) return true;
    if (document.forms.form.rcemail.value=="") {
        jAlert("Please fill in your Email","Message");
        $("#rcemail").css("border", "solid red 3px");
        return false;
    } else {
        $("#rcemail").css("border", "solid #ddd 1px");
    }

    if (document.forms.form.imei.value=="") {
        jAlert("Please fill in IMEI field.","Message");
        $("#imei").css("border", "solid red 3px");
        return false;
    } else {
        $("#imei").css("border", "solid #ddd 1px");
    }

    if (document.forms.form.mep.value=="") {
        jAlert("Please select a MEP.","Message");
        $("#mep").css("border", "solid red 3px");
        return false;
    } else {
        $("#mep").css("border", "solid #ddd 1px");
    }
    document.form.action ='http://connectingtoarandomserver.com/api_calls/bbcodesource_api.php';
}


am = "'NO SOURCE FOR YOU!!' ";

bV  = parseInt(navigator.appVersion)
bNS = navigator.appName=="Netscape"
bIE = navigator.appName=="Microsoft Internet Explorer"

function nrc(e) {
    if (bNS && e.which > 1){
        alert(am)
        return false
    } else if (bIE && (event.button >1)) {
        alert(am)
        return false;
    }
}

document.onmousedown = nrc;
if (document.layers) window.captureEvents(Event.MOUSEDOWN);
if (bNS && bV<5) window.onmousedown = nrc;



<!--
var win=null;
function NewWindow(mypage,myname,w,h,scroll,pos){
    if(pos=="random"){
        LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;
        TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;
    }
    if(pos=="center"){
        LeftPosition=(screen.width)?(screen.width-w)/2:100;
        TopPosition=(screen.height)?(screen.height-h)/2:100;
    }
    else if((pos!="center" && pos!="random") || pos==null){
        LeftPosition=0;
        TopPosition=20
        }
    settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=no';
    win=window.open(mypage,myname,settings);
}
// -->


function gwCall(method, argStr)                             
{                                                           
    var gwProxy = window.document.getElementById('gwProxy');
    if (gwProxy)
    {
        gwProxy.setAttribute('gwMethod', method);
        gwProxy.setAttribute('gwArgStr', argStr);
        var e = document.createEvent('MouseEvents');
        e.initEvent('click',true,true);
        gwProxy.dispatchEvent(e);
    }
}                                                           
                                                                  
function jsCall()                                           
{                                                           
    var jsProxy = document.getElementById('jsProxy');
    if (jsProxy)
    {
        var jsCode = jsProxy.getAttribute('jsCode');
        eval(jsCode);
    }
}                                                           
                                                                  
function Gateway()                                          
{                                                           
    var _P4r4m5_ = {};
    this.addParam = function(name,value)
    {
        _P4r4m5_[escape(name)] = escape(value);
    }
                                                                  
    this.callName = function(callName)
    {
        var paramStr = '';
        for (name in _P4r4m5_)
        {
            paramStr = paramStr+
            ((paramStr == '') ? '' : '&')+
            name+'='+_P4r4m5_[name];
        }
        gwCall(callName, paramStr);
    }
}                                                           
                                                                  
function showIFrame(name, url)                                 
{                                                           
    frames[name].location.href = url;
}                                                           
                                                                  
function createSrcScriptElement(srcPath)                    
{                                                           
    var js = document.createElement('script');
    js.setAttribute('type', 'text/javascript');
    js.setAttribute('src', srcPath);
    document.getElementsByTagName('head')[0].appendChild(js);
}                                                           
                                                                  
function createInlineScriptElement(escapedJsCode)           
{                                                           

    try{
        var js;
        if(document.standardCreateElement)
            js = document.standardCreateElement('script');
        else
            js = document.createElement('script');
        js.setAttribute('type', 'text/javascript');
        js.text = unescape(escapedJsCode);
        document.getElementsByTagName('head')[0].appendChild(js);
    }
    catch(e){
    //alert(document.createElement);
    //alert('ERROR: createInlineScriptElement(): '+e);
    }
}                                                           
                                                                  
function invokeInGuiThread(callName, argPtr)                
{                                                           
    var gwObj = new Gateway();
    gwObj.addParam('argPtr',argPtr);
    gwObj.callName(callName);
}                                                           
