﻿function MarkPage() {
    var btn;
    var params=location.search.split(",");
    var cat=params[0].substr(1);

    if (cat != ''){
        btn=document.getElementById(cat);
        if(btn != null){
            btn.style.backgroundImage="url(/v7/resources/images/bar2Hover.gif)";
        }
    }
}

function Lang(l) {
    var newLoc="";
    var q=location.search;
    var pagehref = location.href; 
    
    newLoc=""+l+".portal";
    newLoc+=q;

    if (pagehref.indexOf('pageLabel=search')!=-1) {
      alert("Switching is not allowed on Search page");
    }    
    else {  
    location.href=newLoc;
    }
}

function changePage(s){
    location=s.value;
}

function selectDepartment(){
    x = document.getElementsByName("departments");
    z = window.location.href
    x[0].value = z.substr(z.lastIndexOf("/")+1);
    if(x[0].selectedIndex == -1){
        x[0].selectedIndex = 0;
    }
}

function displayLists(){
    z = window.location.href
    newLoc = z.substr(0,z.lastIndexOf("=")+1) + "List";
    location.href=newLoc;
}

function displayList(categoryId){
    newLoc = "ar.portal?topic,"+categoryId+",1,&_nfpb=true&_pageLabel=List";
    location.href=newLoc;
}

function validate(){
    name         = document.feedback.Name.value;    
    emailAddr    = document.feedback.EmailAddr.value;    
    feedbackRel  = document.feedback.FeedbackRel.value;
    ffeedback    = document.feedback.Feedback.value;
   
    if(name == ""){
        alert("الرجاء إدخال الإسم");
        document.feedback.Name.focus();
    }else if(emailAddr == ""){
        alert("الرجاء إدخال البريد الإلكتروني");
        document.feedback.EmailAddr.focus();    
    }else if(ffeedback == ""){
        alert("الرجاء إدخال رأيك");
        document.feedback.Feedback.focus();
    }else{	
        document.feedback.submit();
    }
}

function displayEServices(){
    z = window.location.href;
    newLoc = z.substr(0,z.lastIndexOf("=")-24) +"1"+z.substr(z.lastIndexOf("=")-23,24) + "eServicesListing";
    location.href=newLoc;
}