
function selectMenu(id){
    if(id == 1){
        //document.getElementById('todays-news').setAttribute("class", "todays-news-active");
        document.getElementById('todays-news').setAttribute("className", "todays-news-active");
    }else if(id == 2 ){
    //document.getElementById('celebrity-news').setAttribute("class", "celebrity-news-active");       
    document.getElementById('celebrity-news').setAttribute("className", "celebrity-news-active");
}else if(id == 3 ){
//document.getElementById('sport').setAttribute("class", "sport-active");
document.getElementById('sport').setAttribute("className", "sport-active");
}else if(id == 4 ){
//document.getElementById('health').setAttribute("class", "health-active");
document.getElementById('health').setAttribute("className", "health-active");
}else if(id == 5 ){
//document.getElementById('hint').setAttribute("class", "hint-active");
document.getElementById('hint').setAttribute("className", "hint-active");
}else if(id == 6 ){
//document.getElementById('horoscopes').setAttribute("class", "horoscopes-active");
document.getElementById('horoscopes').setAttribute("className", "horoscopes-active");
}else if(id == 7 ){
//document.getElementById('sawaleif').setAttribute("class", "sawaleif-active");
document.getElementById('sawaleif').setAttribute("className", "sawaleif-active");
}else if(id == 8 ){
//document.getElementById('joke').setAttribute("class", "joke-active");
document.getElementById('joke').setAttribute("className", "joke-active");
}else if(id == 9 ){
//document.getElementById('photo').setAttribute("class", "photo-active");
document.getElementById('photo').setAttribute("className", "photo-active");
}
else if(id == 10){
    //document.getElementById('sms-en').setAttribute("class", "sms-en-active");
    document.getElementById('sms-en').setAttribute("className", "sms-en-active");
}else if(id == 11 ){
//document.getElementById('mms-en').setAttribute("class", "mms-en-active");       
document.getElementById('mms-en').setAttribute("className", "mms-en-active");
}else if(id == 15 ){
//document.getElementById('video-en').setAttribute("class", "video-en-active");
document.getElementById('video-en').setAttribute("className", "video-en-active");
}else if(id == 12 ){
//document.getElementById('solution-en').setAttribute("class", "solution-en-active");
document.getElementById('solution-en').setAttribute("className", "solution-en-active");
}else if(id == 13 ){
//document.getElementById('games-en').setAttribute("class", "games-en-active");
document.getElementById('games-en').setAttribute("className", "games-en-active");
}else if(id == 14 ){
//document.getElementById('tunes-en').setAttribute("class", "tunes-en-active");
document.getElementById('tunes-en').setAttribute("className", "tunes-en-active");
}else if(id == 18 ){
//document.getElementById('thems-en').setAttribute("class", "thems-en-active");
document.getElementById('thems-en').setAttribute("className", "thems-en-active");
}else if(id == 17 ){
//document.getElementById('wallpapers-en').setAttribute("class", "wallpapers-en-active");
document.getElementById('wallpapers-en').setAttribute("className", "wallpapers-en-active");
}else if(id == 16 ){
//document.getElementById('cartoons-en').setAttribute("class", "cartoons-en-active");
document.getElementById('cartoons-en').setAttribute("className", "cartoons-en-active");
}

}


function loadVedio(IDS){
    
    document.getElementById('preview1').innerHTML = "";
    //var s1 = new SWFObject("player.swf","ply","398","250","9","#FFFFFF");
    var s1 = new SWFObject("player.swf","ply","314","162","9","#FFFFFF");
    s1.addParam("allowfullscreen","true");
    s1.addParam("allowscriptaccess","always");
    s1.addParam("flashvars","file="+IDS+"video.flv&image="+IDS+"preview.jpg&autostart=true");
    
    s1.write("preview1");
}

function loadVedio2(IDS){
    document.getElementById('preview3').innerHTML = "";
    //var s1 = new SWFObject("player.swf","ply","398","250","9","#FFFFFF");
    var s1 = new SWFObject("player.swf","ply","402","249","9","#FFFFFF");
    s1.addParam("allowfullscreen","true");
    s1.addParam("allowscriptaccess","always");
    s1.addParam("flashvars","file="+IDS+"&image="+IDS+"preview.jpg&autostart=true");
    s1.write("preview3");
    
}

function loadAudio(IDS){
    document.getElementById('preview2').innerHTML = "";
    
    var so = new SWFObject("playerSingle.swf", "mymovie", "182", "67", "7", "#FFFFFF")
    so.addVariable("autoPlay","yes")
    //so.addVariable("playlistPath","playlist.xml")
    //so.write("flashPlayer");
    
    
    
    //    var s1 = new SWFObject("player.swf","ply","398","250","9","#FFFFFF");
    //    s1.addParam("allowfullscreen","true");
    //    s1.addParam("allowscriptaccess","always");
    //if(IDS != "")
    so.addVariable("soundPath", IDS+"video.mp3");
    //so.addVariable("flashvars","file=site-image-vedio-audio/Categories/" + IDS + "/video.flv&image=site-image-vedio-audio/Categories/" + IDS + "/preview.jpg");
    so.write("preview2");
}



function login1() {
    Sexy.display(0);
    //Sexy.alert('<h1>SexyAlertBox</h1><em>versión 1.2</em><br/><p>No te olvides de visitar <a href=\'http://www.coders.me/\'>www.coders.me</a> está lleno de artículos de programación.</p>');
    //Sexy.info('<h1>SexyAlertBox</h1><em>versión 1.2</em><br/><p>&copy;2008-2009 Todos los derechos reservados.</p><p>Sexy Alert Box Sign up basado en PBBAcpBox.</p><p>Visita <a href=\'http://www.coders.me/\'>www.coders.me</a> para obtener la última versión de este script.</p>');
    //document.getElementById("PORTAL").action = 'index.jsp';
    // document.getElementById("PORTAL").submit();
    Sexy.error('<h1>Incorrect mobile number/password combination.</h1><p>\nTakarub passwords are case sensitive. Please check your CAPS lock key. <a href="#" > Forget your password</a> </p>');
    //return false;
    
}

function forgetPassword(lang) {
    Sexy.display(0);
    
    if(lang=='E')
        {
            alert_text='<h1>Enter Mobile Number:</h1>You will receive SMS containing the Password on your mobile number';
        }else{
        alert_text='<h1>&#1575;&#1583;&#1582;&#1604; &#1585;&#1602;&#1605; &#1575;&#1604;&#1605;&#1608;&#1576;&#1575;&#1610;&#1604;:</h1>&#1587;&#1578;&#1589;&#1604;&#1603; &#1585;&#1587;&#1575;&#1604;&#1577; &#1602;&#1589;&#1610;&#1585;&#1577; &#1578;&#1581;&#1578;&#1608;&#1610; &#1593;&#1604;&#1609; &#1603;&#1604;&#1605;&#1577; &#1575;&#1604;&#1587;&#1585;';
    }
    
    Sexy.prompt(alert_text,'' ,{ onComplete: 
        function(returnvalue) {
            if(returnvalue)
                {
                    //alert(returnvalue)
                    getForgetPassword(lang,returnvalue);
                    //document.getElementById("PORTAL").action ='SubscriberAction.do?lang='+lang+'&methodName=doSubscriberGetPwd&mobileNumber='+returnvalue;
                    //document.getElementById("PORTAL").submit();
                }
            }
        });
        
    }
    function focus_usr()
    {
        document.getElementById("mobileNumber").focus();
    }
    function validate_fields(lang)
    {
        var mobileNumber = document.getElementById("mobileNumber").value;
        var password = document.getElementById("password").value;
        
        if(mobileNumber == '')
            {
                if(lang=='E'){
                    Sexy.alert('<h1>Alert</h1><p>\nMandatory Field mobileNumber is missing</p>');
                }
                else
                    {
                        //var text=iconv( 'utf-8','windows-1256', 'نسيبىةمسنبلىمنلىبىى');
                        Sexy.alert('<h1>Alert</h1><p>\n'+'&#1575;&#1604;&#1585;&#1580;&#1575;&#1569; &#1575;&#1583;&#1582;&#1575;&#1604; &#1585;&#1602;&#1605; &#1575;&#1604;&#1605;&#1608;&#1576;&#1575;&#1610;&#1604;'+'<p>');
                    }
                    
                    document.getElementById("mobileNumber").focus();
                    //return false;
                }
                else if(password == '')
                    {
                        if(lang=='E'){
                            Sexy.alert('<h1>Alert</h1><p>\nMandatory Field Password is missing</p>');
                        }
                        else
                            {
                                Sexy.alert('<h1>Alert</h1><p>\n'+'&#1575;&#1604;&#1585;&#1580;&#1575;&#1569; &#1575;&#1583;&#1582;&#1575;&#1604; &#1603;&#1604;&#1605;&#1577; &#1575;&#1604;&#1587;&#1585;'+'<p>');
                            }
                            
                            document.getElementById("password").focus();
                        }
                        else
                            {
                                get(lang);
                            }
                        }
                        
                        function logout(lang)
                        {
                            get(lang);
                        }
                        
                        
                        function pagename() {
                            var sPath = window.location.pathname;
                            var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
                            
                            var pagename="";
                            if(sPage.lastIndexOf('_ar')==-1)
                                {
                                    pagename=sPage.substring(0,sPage.lastIndexOf('.jsp'))+'_ar.jsp';
                                }
                                else
                                    {
                                        pagename=sPage.substring(0,sPage.lastIndexOf('_ar.jsp'))+'.jsp';
                                    }
                                    
                                    if(pagename=='_ar.jsp')
                                        pagename='index_ar.jsp';
                                    
                                    getFormValues(pagename);
                                }
                                
                                
                                function getFormValues(pagename)
                                {     
                                    if(pagename!="Registration.jsp" && pagename!="Registration_ar.jsp" )
                                        {
                                            var str = '';
                                            var elem = document.getElementById('PORTAL').elements;
                                            
                                            for(var i = 0; i < elem.length; i++)
                                                {
                                                    str=str+elem[i].name+"="+elem[i].value;
                                                   //    alert(elem[i].name +" = "+ document.getElementById(elem[i].name).value)
                                                    document.getElementById(elem[i].name).value = elem[i].value;
                                                } 
                                            }
                                            document.getElementById("PORTAL").action = pagename;
                                            document.getElementById("PORTAL").submit();
                                            
                                        }
                                        
                                        function changePic(picname,index)
                                        {
                                            document.getElementById("img"+index).src=picname  
                                            
                                        }
                                        
                                        
                                        function submitForm_1(pageName){
                                            
                                            document.getElementById("PORTAL").action = pageName;
                                            document.getElementById("PORTAL").submit();
                                        }
                                        
                                        function submitForm_2(pageName , categoryid){
                                            //alert(categoryid) 
                                            document.getElementById('categoryid').value = categoryid;
                                            document.getElementById("PORTAL").action = pageName;
                                            document.getElementById("PORTAL").submit();
                                        }
                                        
                                        function submitForm_3(pageName , categoryid, contentid){
                                            document.getElementById('categoryid').value = categoryid;  
                                            document.getElementById('contentid').value = contentid;    
                                            document.getElementById("PORTAL").action = pageName;
                                            document.getElementById("PORTAL").submit();
                                        }
                                        
                                        function submitForm_4(pageName , categoryid,subcategory){
                                            //alert(categoryid)
                                            //alert(subcategory)
                                            document.getElementById('categoryid').value = categoryid;  
                                            document.getElementById('subcategory').value = subcategory; 
                                            document.getElementById("PORTAL").action = pageName;
                                            document.getElementById("PORTAL").submit();
                                        }
                                        
                                        function submitForm_22(pageName , lang){
                                            
                                            document.getElementById('lang').value = lang;
                                            document.getElementById("PORTAL1").action = pageName;
                                            document.getElementById("PORTAL1").submit();
                                        }
                                        
                                        function submitForm_5(pageName ,lang,parentid,requesttype ,flag,login,servicename,operid,opername){
                                            
                                            /*document.getElementById("PORTAL").action = pageName;
                                            document.getElementById("PORTAL").submit();*/
                                            
                                            if(login==0)
                                                {
                                                    if(lang=="E")
                                                        {
                                                            Sexy.alert('<h1>Alert</h1><p>\n You must login before subscribe of this Service. <a href=\'#\' onclick=\"Sexy.display(0);\" style=\"color:red;font-size:10pt;\">Login</a> , <a href=\'Registration.jsp\' style=\"color:red;font-size:10pt;text-decoration:underline\" onclick=\"Sexy.display(0);\">Sign up</a></p>')
                                                        }
                                                        else
                                                            {
                                                                Sexy.alert('<h1>Alert</h1><p>\n You must login before subscribe of this Service. <a href=\'#\' onclick=\"Sexy.display(0);\"style=\"color:red;font-size:10pt;\">Login</a> , <a href=\'Registration_ar.jsp\' style=\"color:red;font-size:10pt;\" onclick=\"Sexy.display(0);\">Sign up</a></p>')
                                                            }
                                                            
                                                        }
                                                        else if(operid==0)
                                                            {
                                                                if(lang=="E")
                                                                    {
                                                                        Sexy.alert('<h1>Sorry</h1><p>\n This Service not available for '+ opername+'.</p>')
                                                                    }
                                                                    else
                                                                        {
                                                                            Sexy.alert('<h1>&#1606;&#1571;&#1587;&#1601;</h1><p>\n &#1607;&#1584;&#1607; &#1575;&#1604;&#1582;&#1583;&#1605;&#1577; &#1594;&#1610;&#1585; &#1605;&#1578;&#1608;&#1601;&#1585;&#1577; &#1604;&#1605;&#1587;&#1578;&#1582;&#1583;&#1605;&#1610; &#1588;&#1576;&#1603;&#1577; '+ opername+'</p>')
                                                                        }
                                                                    }
                                                                    else
                                                                        {
                                                                            var alert_text="";
                                                                            if(lang=="E")
                                                                                {
                                                                                    if(requesttype==1)
                                                                                        {
                                                                                            alert_text='<h1>Confirmation</h1><p>Are you sure you want to Subscribe of '+servicename+' service?</p><p>Press "Ok" to Continue, or Press "Cancel" to Cancel.</p>';
                                                                                        }else{
                                                                                        alert_text='<h1>Confirmation</h1><p>Are you sure you want to Unsubscribe from '+servicename+' service?</p><p>Press "Ok" to Continue, or Press "Cancel" to Cancel.</p>';
                                                                                    }
                                                                                }
                                                                                else
                                                                                    {
                                                                                        if(requesttype==1)
                                                                                            {
                                                                                                alert_text='<h1>Confirmation</h1><p>Are you sure you want to Subscribe of '+servicename+' service?</p><p>Press "Ok" to Continue, or Press "Cancel" to Cancel.</p>';
                                                                                            }else{
                                                                                            alert_text='<h1>Confirmation</h1><p>Are you sure you want to Unsubscribe from '+servicename+' service?</p><p>Press "Ok" to Continue, or Press "Cancel" to Cancel.</p>';
                                                                                        }
                                                                                    }
                                                                                    
                                                                                    
                                                                                    
                                                                                    Sexy.confirm(alert_text, { onComplete: 
                                                                                        function(returnvalue) {
                                                                                            if(returnvalue)
                                                                                                {
                                                                                                    var elem = document.getElementById('PORTAL').elements;
                                                                                                    var poststr="";
                                                                                                    
                                                                                                    if(flag==1){
                                                                                                        poststr='date='+document.getElementById("day").value+"/"+document.getElementById("month").value+"/"+document.getElementById("year").value+"&gender="+document.getElementById("gender").value+"&"; 
                                                                                                    }
                                                                                                    else if(flag==2){
                                                                                                        poststr='date='+document.getElementById("day").value+"/"+document.getElementById("month").value+"/"+document.getElementById("year").value+"&"; 
                                                                                                    }
                                                                                                    else if(flag==3){
                                                                                                        
                                                                                                        poststr='date='+document.getElementById("day").value+"/"+document.getElementById("month").value+"/"+document.getElementById("year").value+'&date1='+document.getElementById("day1").value+"/"+document.getElementById("month1").value+"/"+document.getElementById("year1").value+"&"
                                                                                                    }
                                                                                                    
                                                                                                    for(var i = 0; i < elem.length; i++)
                                                                                                        {
                                                                                                            poststr=poststr+elem[i].name+"="+elem[i].value+"&";
                                                                                                            
                                                                                                        }
                                                                                                        //alert(poststr)
                                                                                                        poststr=poststr+"lang="+lang+"&parentid="+parentid+"&requesttype="+requesttype;
                                                                                                        makePOSTRequest1(pageName, poststr);
                                                                                                        //Sexy.info('<h1>aaaa</h1><p>\n'+document.getElementById("msg").value+'</p>')
                                                                                                    }
                                                                                                    /* else
                                                                                                    {
                                                                                                    Sexy.alert('<h1>SexyAlertBox</h1><em>versión 1.2</em><br/><p>No te olvides de visitar <a href="http://www.coders.me/">www.coders.me</a> está lleno de artículos de programación.</p>');
                                                                                                    }*/
                                                                                                }
                                                                                            });                                                      
                                                                                            
                                                                                            
                                                                                        } 
                                                                                    }
                                                                                    
                                                                                    
                                                                                    function submitForm_6(pageName,lang,contentid,login,operid,opername)
                                                                                    {
                                                                                        if(login==0)
                                                                                            {
                                                                                                if(lang=="E")
                                                                                                    {
                                                                                                        Sexy.alert('<h1>Alert</h1><p>\n You must login before Download this Content.<a href=\'#\' onclick=\"Sexy.display(0);\" style=\"color:red;font-size:10pt;\">Login</a> , <a href=\'Registration.jsp\' style=\"color:red;font-size:10pt;text-decoration:underline\" onclick=\"Sexy.display(0);\">Sign up</a></p>')
                                                                                                    }
                                                                                                    else
                                                                                                        {
                                                                                                            Sexy.alert('<h1>Alert</h1><p>\n You must login before Download this Content.<a href=\'#\' onclick=\"Sexy.display(0);\" style=\"color:red;font-size:10pt;\">Login</a> , <a href=\'Registration_ar.jsp\' style=\"color:red;font-size:10pt;text-decoration:underline\" onclick=\"Sexy.display(0);\">Sign up</a></p>')
                                                                                                        }
                                                                                                    }
                                                                                                    else if(operid==0)
                                                                                                        {
                                                                                                            if(lang=="E")
                                                                                                                {
                                                                                                                    Sexy.alert('<h1>Sorry</h1><p>\n This content not available for '+ opername+'.</p>')
                                                                                                                }
                                                                                                                else
                                                                                                                    {
                                                                                                                        Sexy.alert('<h1>&#1606;&#1571;&#1587;&#1601;</h1><p>\n &#1607;&#1584;&#1575; &#1575;&#1604;&#1605;&#1581;&#1578;&#1608;&#1609; &#1594;&#1610;&#1585; &#1605;&#1578;&#1608;&#1601;&#1585; &#1604;&#1605;&#1587;&#1578;&#1582;&#1583;&#1605;&#1610; &#1588;&#1576;&#1603;&#1577; '+ opername+'</p>')
                                                                                                                    }
                                                                                                                }
                                                                                                                else
                                                                                                                    {
                                                                                                                        /*if(lang=="E"){
                                                                                                                        document.getElementById("msg").value="Thank you for choosing this content, you will receive a link to it.";
                                                                                                                        }else{
                                                                                                                        document.getElementById("msg").value=".شكرا لتحميلك هذا المحتوى, سوف يصلك رابط المحتوى بعد قليل";
                                                                                                                        }*/
                                                                                                                        var elem = document.getElementById('PORTAL').elements;
                                                                                                                        var poststr="lang="+lang+"&contentid="+contentid+"&";
                                                                                                                        
                                                                                                                        for(var i = 0; i < elem.length; i++)
                                                                                                                            {
                                                                                                                                poststr=poststr+elem[i].name+"="+elem[i].value+"&";
                                                                                                                                
                                                                                                                            }
                                                                                                                            //alert(poststr)
                                                                                                                            
                                                                                                                            makePOSTRequest1(pageName, poststr,lang);
                                                                                                                            //Sexy.info('<h1>aaaa</h1><p>\n'+document.getElementById("msg").value+'</p>')
                                                                                                                        }
                                                                                                                    }
                                                                                                                    
                                                                                                                    var http_request = false;
                                                                                                                    function makePOSTRequest1(url, parameters) {
                                                                                                                        http_request = false;
                                                                                                                        if (window.XMLHttpRequest) { // Mozilla, Safari,...
                                                                                                                            http_request = new XMLHttpRequest();
                                                                                                                            if (http_request.overrideMimeType) {
                                                                                                                                // set type accordingly to anticipated content type
                                                                                                                                //http_request.overrideMimeType('text/xml');
                                                                                                                                http_request.overrideMimeType('text/html');
                                                                                                                            }
                                                                                                                        } else if (window.ActiveXObject) { // IE
                                                                                                                        try {
                                                                                                                            http_request = new ActiveXObject("Msxml2.XMLHTTP");
                                                                                                                        } catch (e) {
                                                                                                                        try {
                                                                                                                            http_request = new ActiveXObject("Microsoft.XMLHTTP");
                                                                                                                        } catch (e) {}
                                                                                                                    }
                                                                                                                }
                                                                                                                if (!http_request) {
                                                                                                                    alert('Cannot create XMLHTTP instance');
                                                                                                                    return false;
                                                                                                                }
                                                                                                                
                                                                                                                http_request.onreadystatechange = alertContents1;
                                                                                                                http_request.open('POST', encodeURIComponent(url), true);
                                                                                                                http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=utf-8");
                                                                                                                http_request.setRequestHeader("Content-length", parameters.length);
                                                                                                                http_request.setRequestHeader("Connection", "close");
                                                                                                                http_request.send(parameters);
                                                                                                            }
                                                                                                            
                                                                                                            function alertContents1() {
                                                                                                                //alert(http_request.responseText);
                                                                                                                if (http_request.readyState == 4) {
                                                                                                                    if (http_request.status == 200) {
                                                                                                                        //alert(http_request.responseText);
                                                                                                                        if(http_request.responseText.indexOf("Download?") == 0)
                                                                                                                            {
                                                                                                                                Sexy.prompt('<h1>Enter Code:</h1>Your will receive SMS containing your Authorization code to download,enter the code into the below box and press download to get the video on your PC. ','' ,{ onComplete: 
                                                                                                                                    function(returnvalue) {
                                                                                                                                        if(returnvalue)
                                                                                                                                            {
                                                                                                                                                
                                                                                                                                                var poststr=http_request.responseText+"&key="+returnvalue;
                                                                                                                                                
                                                                                                                                                //alert(poststr)
                                                                                                                                                document.getElementById("PORTAL").action =poststr;
                                                                                                                                                document.getElementById("PORTAL").submit();
                                                                                                                                                
                                                                                                                                            }
                                                                                                                                            /*else
                                                                                                                                            {
                                                                                                                                            Sexy.error('<h1>Error </h1><p></p>');
                                                                                                                                            }*/
                                                                                                                                        }
                                                                                                                                    });
                                                                                                                                }else
                                                                                                                                {
                                                                                                                                    Sexy.info('<h1>Done</h1><p>\n'+http_request.responseText+'</p>')
                                                                                                                                }
                                                                                                                                
                                                                                                                                //Sexy.info('<h1>aaaa</h1><p>\n'+document.getElementById("msg").value+'</p>')
                                                                                                                                /*document.getElementById("PORTAL").action = location.href;
                                                                                                                                document.getElementById("PORTAL").submit();*/
                                                                                                                                
                                                                                                                                
                                                                                                                                
                                                                                                                                
                                                                                                                            } else {
                                                                                                                            Sexy.info('<h1>error</h1><p>\nThere was a problem with the request.');
                                                                                                                        }
                                                                                                                    }
                                                                                                                }
                                                                                                                
                                                                                                                
                                                                                                                
                                                                                                                
                                                                                                                
                                                                                                                var http_request = false;
                                                                                                                function makePOSTRequest(url, parameters) {
                                                                                                                    http_request = false;
                                                                                                                    if (window.XMLHttpRequest) { // Mozilla, Safari,...
                                                                                                                        http_request = new XMLHttpRequest();
                                                                                                                        if (http_request.overrideMimeType) {
                                                                                                                            // set type accordingly to anticipated content type
                                                                                                                            //http_request.overrideMimeType('text/xml');
                                                                                                                            http_request.overrideMimeType('text/html');
                                                                                                                        }
                                                                                                                    } else if (window.ActiveXObject) { // IE
                                                                                                                    try {
                                                                                                                        http_request = new ActiveXObject("Msxml2.XMLHTTP");
                                                                                                                    } catch (e) {
                                                                                                                    try {
                                                                                                                        http_request = new ActiveXObject("Microsoft.XMLHTTP");
                                                                                                                    } catch (e) {}
                                                                                                                }
                                                                                                            }
                                                                                                            if (!http_request) {
                                                                                                                alert('Cannot create XMLHTTP instance');
                                                                                                                return false;
                                                                                                            }
                                                                                                            
                                                                                                            http_request.onreadystatechange = alertContents;
                                                                                                            http_request.open('POST', encodeURIComponent(url), true);
                                                                                                            http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=utf-8");
                                                                                                            http_request.setRequestHeader("Content-length", parameters.length);
                                                                                                            http_request.setRequestHeader("Connection", "close");
                                                                                                            http_request.send(parameters);
                                                                                                        }
                                                                                                        
                                                                                                        function alertContents() {
                                                                                                            //alert(http_request.responseText);
                                                                                                            if (http_request.readyState == 4) {
                                                                                                                if (http_request.status == 200) {
                                                                                                                    //alert(http_request.responseText);
                                                                                                                    if(http_request.responseText=="")
                                                                                                                        {
                                                                                                                            document.getElementById("PORTAL").action = location.href;
                                                                                                                            document.getElementById("PORTAL").submit();
                                                                                                                        }else
                                                                                                                        {
                                                                                                                            Sexy.error(http_request.responseText)}
                                                                                                                        
                                                                                                                        
                                                                                                                        
                                                                                                                    } else {
                                                                                                                    alert('There was a problem with the request.');
                                                                                                                }
                                                                                                            }
                                                                                                        }
                                                                                                        
                                                                                                        function get(lang) {
                                                                                                            var elem = document.getElementById('loginform').elements;
                                                                                                            var poststr="";
                                                                                                            for(var i = 0; i < elem.length; i++)
                                                                                                                {
                                                                                                                    poststr=poststr+elem[i].name+"="+elem[i].value+"&";
                                                                                                                    
                                                                                                                }
                                                                                                                poststr=poststr+"lang="+lang;
                                                                                                                makePOSTRequest('SubscriberAction.do', poststr);
                                                                                                            }
                                                                                                            
                                                                                                            
                                                                                                            
                                                                                                            
                                                                                                            var http_request = false;
                                                                                                            function makePOSTRequestRig(url, parameters) {
                                                                                                                http_request = false;
                                                                                                                if (window.XMLHttpRequest) { // Mozilla, Safari,...
                                                                                                                    http_request = new XMLHttpRequest();
                                                                                                                    if (http_request.overrideMimeType) {
                                                                                                                        // set type accordingly to anticipated content type
                                                                                                                        //http_request.overrideMimeType('text/xml');
                                                                                                                        http_request.overrideMimeType('text/html');
                                                                                                                    }
                                                                                                                } else if (window.ActiveXObject) { // IE
                                                                                                                try {
                                                                                                                    http_request = new ActiveXObject("Msxml2.XMLHTTP");
                                                                                                                } catch (e) {
                                                                                                                try {
                                                                                                                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                                                                                                                } catch (e) {}
                                                                                                            }
                                                                                                        }
                                                                                                        if (!http_request) {
                                                                                                            alert('Cannot create XMLHTTP instance');
                                                                                                            return false;
                                                                                                        }
                                                                                                        
                                                                                                        http_request.onreadystatechange = alertContentsRig;
                                                                                                        http_request.open('POST', encodeURIComponent(url), true);
                                                                                                        http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=utf-8");
                                                                                                        http_request.setRequestHeader("Content-length", parameters.length);
                                                                                                        http_request.setRequestHeader("Connection", "close");
                                                                                                        http_request.send(parameters);
                                                                                                    }
                                                                                                    
                                                                                                    function alertContentsRig() {
                                                                                                        //alert(http_request.responseText);
                                                                                                        if (http_request.readyState == 4) {
                                                                                                            if (http_request.status == 200) {
                                                                                                                //alert(http_request.responseText);
                                                                                                                if(http_request.responseText=="")
                                                                                                                    {
                                                                                                                        Sexy.info('<h1>Done</h1><p>\n thank you for registration.your password will be delivered to you on your mobile so you can login this will take several minutes.</p>');
                                                                                                                        document.getElementById("PORTAL").firstName.value='';
                                                                                                                        document.getElementById("PORTAL").middleName.value='';
                                                                                                                        document.getElementById("PORTAL").lastName.value='';
                                                                                                                        document.getElementById("PORTAL").email.value='';
                                                                                                                        document.getElementById("PORTAL").countryId.value='0';
                                                                                                                        document.getElementById("PORTAL").operatorId.value='0';
                                                                                                                        document.getElementById("PORTAL").city.value='';
                                                                                                                        document.getElementById("PORTAL").mobileNumber.value='';
                                                                                                                        document.getElementById("PORTAL").mobileType.value='';
                                                                                                                    }else
                                                                                                                    {
                                                                                                                        Sexy.error(http_request.responseText)}
                                                                                                                } else {
                                                                                                                alert('There was a problem with the request.');
                                                                                                            }
                                                                                                        }
                                                                                                    }
                                                                                                    
                                                                                                    function getRig(lang) {
                                                                                                        var elem = document.getElementById('PORTAL').elements;
                                                                                                        var poststr="";
                                                                                                        for(var i = 0; i < elem.length; i++)
                                                                                                            {
                                                                                                                poststr=poststr+elem[i].name+"="+elem[i].value+"&";
                                                                                                                
                                                                                                            }
                                                                                                            poststr=poststr+"lang="+lang;
                                                                                                            
                                                                                                            makePOSTRequestRig('SubscriberAction.do', poststr);
                                                                                                        }
                                                                                                        
                                                                                                        
                                                                                                        
                                                                                                        var http_request = false;
                                                                                                        function makePOSTRequestSendMail(url, parameters) {
                                                                                                            http_request = false;
                                                                                                            if (window.XMLHttpRequest) { // Mozilla, Safari,...
                                                                                                                http_request = new XMLHttpRequest();
                                                                                                                if (http_request.overrideMimeType) {
                                                                                                                    // set type accordingly to anticipated content type
                                                                                                                    //http_request.overrideMimeType('text/xml');
                                                                                                                    http_request.overrideMimeType('text/html');
                                                                                                                }
                                                                                                            } else if (window.ActiveXObject) { // IE
                                                                                                            try {
                                                                                                                http_request = new ActiveXObject("Msxml2.XMLHTTP");
                                                                                                            } catch (e) {
                                                                                                            try {
                                                                                                                http_request = new ActiveXObject("Microsoft.XMLHTTP");
                                                                                                            } catch (e) {}
                                                                                                        }
                                                                                                    }
                                                                                                    if (!http_request) {
                                                                                                        alert('Cannot create XMLHTTP instance');
                                                                                                        return false;
                                                                                                    }
                                                                                                    
                                                                                                    http_request.onreadystatechange = alertContentsSendMail;
                                                                                                    http_request.open('POST', encodeURIComponent(url), true);
                                                                                                    http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=utf-8");
                                                                                                    http_request.setRequestHeader("Content-length", parameters.length);
                                                                                                    http_request.setRequestHeader("Connection", "close");
                                                                                                    http_request.send(parameters);
                                                                                                    
                                                                                                }
                                                                                                
                                                                                                function alertContentsSendMail() {
                                                                                                    //alert(http_request.responseText);
                                                                                                    if (http_request.readyState == 4) {
                                                                                                        if (http_request.status == 200) {
                                                                                                            //alert(http_request.responseText);
                                                                                                            if(http_request.responseText=="")
                                                                                                                {
                                                                                                                    //Sexy.info('<h1>Done</h1><p>\n'+http_request.responseText+'</p>')
                                                                                                                }else
                                                                                                                {
                                                                                                                    Sexy.info('<h1>Done</h1><p>\n'+http_request.responseText+'</p>')
                                                                                                                    document.getElementById("PORTAL").name.value='';
                                                                                                                    document.getElementById("PORTAL").email.value='';
                                                                                                                    document.getElementById("PORTAL").body.value='';
                                                                                                                    document.getElementById("PORTAL").subject.value='';
                                                                                                                    /*document.getElementById("PORTAL").action = location.href;
                                                                                                                    document.getElementById("PORTAL").submit();*/
                                                                                                                }
                                                                                                            } else {
                                                                                                            alert('There was a problem with the request.');
                                                                                                        }
                                                                                                    }
                                                                                                }
                                                                                                
                                                                                                function getSendMail(lang) {
                                                                                                    
                                                                                                    var elem = document.getElementById('PORTAL').elements;
                                                                                                    var poststr="";
                                                                                                    for(var i = 0; i < elem.length; i++)
                                                                                                        {
                                                                                                            
                                                                                                            poststr=poststr+elem[i].name+"="+elem[i].value+"&";
                                                                                                            
                                                                                                        }
                                                                                                        poststr=poststr+"lang="+lang;
                                                                                                        
                                                                                                        makePOSTRequestSendMail('SendMail', poststr);
                                                                                                        
                                                                                                    }
                                                                                                    
                                                                                                    function getSendSMS(lang,msglang,login) {
                                                                                                        if(login==0)
                                                                                                            {
                                                                                                                if(lang=="E")
                                                                                                                    {
                                                                                                                        Sexy.alert('<h1>Alert</h1><p>\n You must login before Send SMS . <a href=\'#\' onclick=\"Sexy.display(0);\" style=\"color:red;font-size:10pt;\">Login</a> , <a href=\'Registration.jsp\' style=\"color:red;font-size:10pt;text-decoration:underline\" onclick=\"Sexy.display(0);\">Sign up</a></p>')
                                                                                                                    }
                                                                                                                    else
                                                                                                                        {
                                                                                                                            Sexy.alert('<h1>Alert</h1><p>\n You must login before Send SMS. <a href=\'#\' onclick=\"Sexy.display(0);\"style=\"color:red;font-size:10pt;\">Login</a> , <a href=\'Registration_ar.jsp\' style=\"color:red;font-size:10pt;\" onclick=\"Sexy.display(0);\">Sign up</a></p>')
                                                                                                                        }
                                                                                                                    }
                                                                                                                    else if(login==2)
                                                                                                                        {
                                                                                                                            if(lang=="E")
                                                                                                                                {
                                                                                                                                    Sexy.alert('<h1>Alert</h1><p>\n </p>')
                                                                                                                                }
                                                                                                                                else
                                                                                                                                    {
                                                                                                                                        Sexy.alert('<h1>Alert</h1><p>\n</p>')
                                                                                                                                    }
                                                                                                                                }
                                                                                                                                else{
                                                                                                                                    var elem = document.getElementById('PORTAL').elements;
                                                                                                                                    var poststr="";
                                                                                                                                    for(var i = 0; i < elem.length; i++)
                                                                                                                                        {
                                                                                                                                            
                                                                                                                                            poststr=poststr+elem[i].name+"="+elem[i].value+"&";                                                                                                                                
                                                                                                                                        }
                                                                                                                                        poststr=poststr+"lang="+msglang;
                                                                                                                                        //document.getElementById("PORTAL").action = 'SendSMS';
                                                                                                                                        //document.getElementById("PORTAL").submit();
                                                                                                                                        makePOSTRequestSendMail('SendSMS', poststr);
                                                                                                                                    }
                                                                                                                                }
                                                                                                                                var http_request = false;
                                                                                                                                function makePOSTRequestForgetPassword(url, parameters,lang) {
                                                                                                                                    http_request = false;
                                                                                                                                    if (window.XMLHttpRequest) { // Mozilla, Safari,...
                                                                                                                                        http_request = new XMLHttpRequest();
                                                                                                                                        if (http_request.overrideMimeType) {
                                                                                                                                            // set type accordingly to anticipated content type
                                                                                                                                            //http_request.overrideMimeType('text/xml');
                                                                                                                                            http_request.overrideMimeType('text/html');
                                                                                                                                        }
                                                                                                                                    } else if (window.ActiveXObject) { // IE
                                                                                                                                    try {
                                                                                                                                        http_request = new ActiveXObject("Msxml2.XMLHTTP");
                                                                                                                                    } catch (e) {
                                                                                                                                    try {
                                                                                                                                        http_request = new ActiveXObject("Microsoft.XMLHTTP");
                                                                                                                                    } catch (e) {}
                                                                                                                                }
                                                                                                                            }
                                                                                                                            if (!http_request) {
                                                                                                                                alert('Cannot create XMLHTTP instance');
                                                                                                                                return false;
                                                                                                                            }
                                                                                                                            
                                                                                                                            http_request.onreadystatechange = alertContentsForgetPassword;
                                                                                                                            http_request.open('POST', encodeURIComponent(url), true);
                                                                                                                            http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded;charset=utf-8");
                                                                                                                            http_request.setRequestHeader("Content-length", parameters.length);
                                                                                                                            http_request.setRequestHeader("Connection", "close");
                                                                                                                            http_request.send(parameters);
                                                                                                                        }
                                                                                                                        
                                                                                                                        function alertContentsForgetPassword() {
                                                                                                                            //alert(http_request.responseText);
                                                                                                                            if (http_request.readyState == 4) {
                                                                                                                                if (http_request.status == 200) {
                                                                                                                                    //alert(http_request.responseText);
                                                                                                                                    if(http_request.responseText.indexOf("<h1>Done</h1>") == 0)
                                                                                                                                        {
                                                                                                                                            Sexy.info(http_request.responseText);
                                                                                                                                        }else
                                                                                                                                        {
                                                                                                                                            Sexy.error(http_request.responseText)}
                                                                                                                                    } else {
                                                                                                                                    alert('There was a problem with the request.');
                                                                                                                                }
                                                                                                                            }
                                                                                                                        }
                                                                                                                        
                                                                                                                        function getForgetPassword(lang,returnvalue) {
                                                                                                                            var poststr="";
                                                                                                                            poststr ='lang='+lang+'&methodName=doSubscriberGetPwd&mobileNumber='+returnvalue;
                                                                                                                            makePOSTRequestForgetPassword('SubscriberAction.do', poststr,lang);
                                                                                                                        }
                                                                                                                        
                                                                                                                        function setLang()
                                                                                                                        {
                                                                                                                            
                                                                                                                            var i=0;
                                                                                                                            var lang="";
                                                                                                                            while(i<document.getElementById("body").value.length)
                                                                                                                                {
                                                                                                                                    var character = document.getElementById("body").value.substring(i,1);
                                                                                                                                    var code = document.getElementById("body").value.charCodeAt(i);
                                                                                                                                    var err_char = document.getElementById("body").value.charAt(i);
                                                                                                                                    if(code >255)
                                                                                                                                        {
                                                                                                                                            i=document.getElementById("body").value.length;
                                                                                                                                            lang="A";
                                                                                                                                        }
                                                                                                                                        else
                                                                                                                                            {
                                                                                                                                                lang="E";
                                                                                                                                                i++; 
                                                                                                                                            }
                                                                                                                                        }
                                                                                                                                        return lang; 
                                                                                                                                    }
                                                                                                                                    
                                                                                                                                    function CountCharactersLeft()
                                                                                                                                    {
                                                                                                                                        
                                                                                                                                        
                                                                                                                                        var strTemp = "";
                                                                                                                                        var strCharCounter = 0;
                                                                                                                                        
                                                                                                                                        
                                                                                                                                        for (var i = 0; i < document.getElementById("body").value.length; i++)
                                                                                                                                            {
                                                                                                                                                var strChar = document.getElementById("body").value.substring(i, i + 1);
                                                                                                                                                strTemp += strChar;
                                                                                                                                                strCharCounter ++;
                                                                                                                                                
                                                                                                                                            }
                                                                                                                                            document.getElementById('rem_char').value=document.getElementById("body").value.length;
                                                                                                                                            
                                                                                                                                            
                                                                                                                                            if(setLang()=='A')
                                                                                                                                                {
                                                                                                                                                    if(document.getElementById("body").value.length <=70 )
                                                                                                                                                        {
                                                                                                                                                            document.getElementById('msgs').value=1
                                                                                                                                                        }
                                                                                                                                                        else
                                                                                                                                                            {
                                                                                                                                                                document.getElementById('msgs').value= Math.ceil(document.getElementById("body").value.length /67)
                                                                                                                                                            }
                                                                                                                                                        }
                                                                                                                                                        
                                                                                                                                                        if(setLang()=='E')
                                                                                                                                                            {
                                                                                                                                                                if(document.getElementById("body").value.length <=160 )
                                                                                                                                                                    {
                                                                                                                                                                        document.getElementById('msgs').value=1
                                                                                                                                                                    }
                                                                                                                                                                    else
                                                                                                                                                                        {
                                                                                                                                                                            document.getElementById('msgs').value= Math.ceil(document.getElementById("body").value.length /153)
                                                                                                                                                                        }
                                                                                                                                                                    }
                                                                                                                                                                }      
                                                                                                                                                                function validate(login){
                                                                                                                                                                    
                                                                                                                                                                    msg = "" ;
                                                                                                                                                                    main_msg = "";
                                                                                                                                                                    error = false ;
                                                                                                                                                                    doFocus="";
                                                                                                                                                                    
                                                                                                                                                                    
                                                                                                                                                                    if (document.getElementById("PORTAL").email.value == '' || document.getElementById("PORTAL").email.value == null )
                                                                                                                                                                        {
                                                                                                                                                                            msg="please enter email " ;
                                                                                                                                                                            //main_msg += msg + "\n" ;
                                                                                                                                                                            Sexy.alert('<h1>Alert</h1><p>\n'+msg+'</p>');
                                                                                                                                                                            
                                                                                                                                                                            if( doFocus == "" )
                                                                                                                                                                                doFocus = eval('document.getElementById("PORTAL").email') ;
                                                                                                                                                                            doFocus.focus() ;
                                                                                                                                                                        }
                                                                                                                                                                        else if (document.getElementById("PORTAL").body.value == '' || document.getElementById("PORTAL").body.value == null)
                                                                                                                                                                            {
                                                                                                                                                                                msg="please enter the message body " ;
                                                                                                                                                                                //main_msg += msg + "\n" ;
                                                                                                                                                                                Sexy.alert('<h1>Alert</h1><p>\n'+msg+'</p>');
                                                                                                                                                                                if( doFocus == "" )
                                                                                                                                                                                    doFocus = eval('document.getElementById("PORTAL").body') ;
                                                                                                                                                                                doFocus.focus() ;
                                                                                                                                                                            }
                                                                                                                                                                            else {
                                                                                                                                                                                getSendSMS('E',setLang(),login)
                                                                                                                                                                                
                                                                                                                                                                            }
                                                                                                                                                                        }
                                                                                                                                                                        
                                                                                                                                                                        function isNumber(field)
                                                                                                                                                                        { 
                                                                                                                                                                            
                                                                                                                                                                            var re = /^[0-9]*$/;
                                                                                                                                                                            if (!re.test(field.value))
                                                                                                                                                                                { 
                                                                                                                                                                                    
                                                                                                                                                                                    field.value = field.value.replace(/[^0-9-'.'-',']/g,""); 
                                                                                                                                                                                    alert('Invalid entry, only numeric characters allowed.');
                                                                                                                                                                                }
                                                                                                                                                                            }        
                                                                                                                                                                            
                                                                                                                                                                            function uploadCV(msg,page)
                                                                                                                                                                            {
                                                                                                                                                                                document.write('<script type="text/javascript" src="sexyalertbox.v1.2.moo.js"></script>');
                                                                                                                                                                                document.write('<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/mootools/1.2.1/mootools-yui-compressed.js"></script>');
                                                                                                                                                                                
                                                                                                                                                                                Sexy.info('<h1>Done</h1><p>\n your CV has been Upload,thank you</p>')
                                                                                                                                                                            }
                                                                                                                                                                            
                                                                                                                                                                            
                                                                                                                                                                            