

    function CheckCheckAll() {

      var TotalBoxes = 0;
      var TotalOn = 0;
      for (var i=0;i<document.form.elements.length;i++) {
        var e = document.form.elements[i];
        if ((e.name != 'allbox') && (e.type=='checkbox')) {
          TotalBoxes++;
          if (e.checked) {
            TotalOn++;
          }
        }
      }
      if (TotalBoxes==TotalOn) {
        document.form.allbox.checked=true;
      }
      else {
        document.form.allbox.checked=false;
      }
    }




    var marked_row = new Array;
function setPointer(theRow, theRowNum, theAction, theDefaultColor, thePointerColor, theMarkColor)
{
    var theCells = null;

    // 1. Pointer and mark feature are disabled or the browser can't get the
    //    row -> exits
    if ((thePointerColor == '' && theMarkColor == '')
        || typeof(theRow.style) == 'undefined') {
        return false;
    }

    // 2. Gets the current row and exits if the browser can't get it
    if (typeof(document.getElementsByTagName) != 'undefined') {
        theCells = theRow.getElementsByTagName('td');
    }
    else if (typeof(theRow.cells) != 'undefined') {
        theCells = theRow.cells;
    }
    else {
        return false;
    }

    // 3. Gets the current color...
    var rowCellsCnt  = theCells.length;
    var domDetect    = null;
    var currentColor = null;
    var newColor     = null;
    // 3.1 ... with DOM compatible browsers except Opera that does not return
    //         valid values with "getAttribute"
    if (typeof(window.opera) == 'undefined'
        && typeof(theCells[0].getAttribute) != 'undefined') {
        currentColor = theCells[0].getAttribute('bgcolor');
        domDetect    = true;
    }
    // 3.2 ... with other browsers
    else {
        currentColor = theCells[0].style.backgroundColor;
        domDetect    = false;
    } // end 3

    // 3.3 ... Opera changes colors set via HTML to rgb(r,g,b) format so fix it
    if (currentColor.indexOf("rgb") >= 0)
    {
        var rgbStr = currentColor.slice(currentColor.indexOf('(') + 1,
                                     currentColor.indexOf(')'));
        var rgbValues = rgbStr.split(",");
        currentColor = "#";
        var hexChars = "0123456789ABCDEF";
        for (var i = 0; i < 3; i++)
        {
            var v = rgbValues[i].valueOf();
            currentColor += hexChars.charAt(v/16) + hexChars.charAt(v%16);
        }
    }

    // 4. Defines the new color
    // 4.1 Current color is the default one
    if (currentColor == ''
        || currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
        if (theAction == 'over' && thePointerColor != '') {
            newColor              = thePointerColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
            // Garvin: deactivated onclick marking of the checkbox because it's also executed
            // when an action (like edit/delete) on a single item is performed. Then the checkbox
            // would get deactived, even though we need it activated. Maybe there is a way
            // to detect if the row was clicked, and not an item therein...
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = true;
        }
    }
    // 4.1.2 Current color is the pointer one
    else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
             && (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) {
        if (theAction == 'out') {
            newColor              = theDefaultColor;
        }
        else if (theAction == 'click' && theMarkColor != '') {
            newColor              = theMarkColor;
            marked_row[theRowNum] = true;
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = true;
        }
    }
    // 4.1.3 Current color is the marker one
    else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
        if (theAction == 'click') {
            newColor              = (thePointerColor != '')
                                  ? thePointerColor
                                  : theDefaultColor;
            marked_row[theRowNum] = (typeof(marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])
                                  ? true
                                  : null;
            // document.getElementById('id_rows_to_delete' + theRowNum).checked = false;
        }
    } // end 4

    // 5. Sets the new color...
    if (newColor) {
        var c = null;
        // 5.1 ... with DOM compatible browsers except Opera
        if (domDetect) {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].setAttribute('bgcolor', newColor, 0);
            } // end for
        }
        // 5.2 ... with other browsers
        else {
            for (c = 0; c < rowCellsCnt; c++) {
                theCells[c].style.backgroundColor = newColor;
            }
        }
    } // end 5

    return true;
}


var arrOldValues;
function SelectAllList(CONTROL){
for(var i = 0;i < CONTROL.length;i++){
CONTROL.options[i].selected = true;
}
}

function DeselectAllList(CONTROL){
for(var i = 0;i < CONTROL.length;i++){
CONTROL.options[i].selected = false;
}
}


function FillListValues(CONTROL){
var arrNewValues;
var intNewPos;
var strTemp = GetSelectValues(CONTROL);
arrNewValues = strTemp.split(",");
for(var i=0;i<arrNewValues.length-1;i++){
if(arrNewValues[i]==1){
intNewPos = i;
}
}

for(var i=0;i<arrOldValues.length-1;i++){
if(arrOldValues[i]==1 && i != intNewPos){
CONTROL.options[i].selected= true;
}
else if(arrOldValues[i]==0 && i != intNewPos){
CONTROL.options[i].selected = false;
}

if(arrOldValues[intNewPos]== 1){
CONTROL.options[intNewPos].selected = false;
}
else{
CONTROL.options[intNewPos].selected = true;
}
}
}


function GetSelectValues(CONTROL){
var strTemp = "";
for(var i = 0;i < CONTROL.length;i++){
if(CONTROL.options[i].selected == true){
strTemp += "1,";
}
else{
strTemp += "0,";
}
}
return strTemp;
}

function GetCurrentListValues(CONTROL){
var strValues = "";
strValues = GetSelectValues(CONTROL);
arrOldValues = strValues.split(",")
}




 function showhiddendiv()
{
document.all.reply.style.visibility="visible";
}


function hiddthisdiv()
{
var browserType;

if (document.layers) {browserType = "nn4"}
if (document.all) {browserType = "ie"}
if (window.navigator.userAgent.toLowerCase().match("gecko")) {browserType= "gecko"}
if (browserType == "gecko" )
     document.poppedLayer = eval('document.getElementById(\'reply\')');
  else if (browserType == "ie")
     document.poppedLayer = eval('document.all[\'reply\']');
  else
     document.poppedLayer = eval('document.layers[\'`reply\']');
  document.poppedLayer.style.visibility = "hidden";
}



function CheckFieldBlank_pms() {
if (myform.subject.value == ""){
alert("يجب كتابة عنوان الرسالة");
myform.subject.focus();
return false;
}

if (myform.pm_to.value == ""){
alert("لا بد من تحديد شخص واحد علي الاقل لارسال الرسالة اليه");
myform.pm_to.focus();
return false;
}

}

function enable_multidest_reports() {
var valvalue = document.myform.B1.disabled=false;


}



function CheckField_data_editor() {
if (myform.section.value == ""){
alert("يجب كتابة عنوان الموضوع");
myform.section.focus();
return false;
}


}



function CheckAll_ig() {
for (var i=0;i<document.form.elements.length;i++) {
        var e = document.form.elements[i];
        if ((e.name != 'allbox_igg') && (e.type=='radio')) {
          //e.checked = document.form.allbox_igg.ignored_file_id.checked;
            document.form.ignored_file_id.checked=true;
}
}
}



function Checkview_cat_for_arteditors(num){
var m = 0;
for (var i=0;i<document.form.elements.length;i++) {
        var e = document.form.elements[i];
        if ((e.type=='radio')) {
        if ((e.checked==true) ) {
        m++
        }

        }
}
            if(m < num){
            var ammsg = 'لقد قمت بتحديد'+ m +'فقط من اصل' + num +'صور';
            alert(ammsg);
            return false;
            }
}



function checkandalert(){
var m = 0;
for (var i=0;i<document.form.elements.length;i++) {
        var e = document.form.elements[i];
        if ((e.type=='checkbox')) {
        if ((e.checked==true) ) {
        m++
        }

        }
}
            if(m < 1){
            var ammsg = 'يجب تحديد عنصر واحد علي الاقل';
            alert(ammsg);
            return false;
            }else{
            return confirm('التأكيد علي حذف العناصر المحددة');
             }
}


function must_sel_item(){
var m = 0;
for (var i=0;i<document.form.elements.length;i++) {
        var e = document.form.elements[i];
        if ((e.type=='checkbox')) {
        if ((e.checked==true) ) {
        m++
        }

        }
}
            if(m < 1){
            var ammsg = 'يجب تحديد عنصر واحد علي الاقل';
            alert(ammsg);
            return false;
            }
}

function new_window(axzfds,axcfds,acxfds)
{neww=window.open(axzfds,axcfds,acxfds);
neww.window.focus();
}

function power_newwindow(url,myheight,mywidth){
neww = window.open(url,'mywin','left=20,top=20,width='+mywidth+',height='+myheight+',toolbar=0,resizable=1,scrollbars=1');
neww.window.focus();
}



var state = 'hidden';
function showhide(layer_ref) {

if (state == 'visible') {
state = 'hidden';
}
else {
state = 'visible';
}
if (document.all) { //IS IE 4 or 5 (or 6 beta)
eval( "document.all." + layer_ref + ".style.visibility = state");
}
if (document.layers) { //IS NETSCAPE 4 or below
document.layers[layer_ref].visibility = state;
}
if (document.getElementById && !document.all) {
maxwell_smart = document.getElementById(layer_ref);
maxwell_smart.style.visibility = state;
}
}


function ietruebody(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function ddrivetip(thetext, thecolor, thewidth){
if (ns6||ie){
if (typeof thewidth!="undefined") tipobj.style.width=thewidth+"px"
if (typeof thecolor!="undefined" && thecolor!="") tipobj.style.backgroundColor=thecolor
tipobj.innerHTML=thetext
enabletip=true
return false
}
}

function positiontip(e){
if (enabletip){
var curX=(ns6)?e.pageX : event.clientX+ietruebody().scrollLeft;
var curY=(ns6)?e.pageY : event.clientY+ietruebody().scrollTop;
//Find out how close the mouse is to the corner of the window
var rightedge=ie&&!window.opera? ietruebody().clientWidth-event.clientX-offsetxpoint : window.innerWidth-e.clientX-offsetxpoint-20
var bottomedge=ie&&!window.opera? ietruebody().clientHeight-event.clientY-offsetypoint : window.innerHeight-e.clientY-offsetypoint-20

var leftedge=(offsetxpoint<0)? offsetxpoint*(-1) : -1000

//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<tipobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
tipobj.style.left=ie? ietruebody().scrollLeft+event.clientX-tipobj.offsetWidth+"px" : window.pageXOffset+e.clientX-tipobj.offsetWidth+"px"
else if (curX<leftedge)
tipobj.style.left="5px"
else
//position the horizontal position of the menu where the mouse is positioned
tipobj.style.left=curX+offsetxpoint+"px"

//same concept with the vertical position
if (bottomedge<tipobj.offsetHeight)
tipobj.style.top=ie? ietruebody().scrollTop+event.clientY-tipobj.offsetHeight-offsetypoint+"px" : window.pageYOffset+e.clientY-tipobj.offsetHeight-offsetypoint+"px"
else
tipobj.style.top=curY+offsetypoint+"px"
tipobj.style.visibility="visible"
}
}

function hideddrivetip(){
if (ns6||ie){
enabletip=false
tipobj.style.visibility="hidden"
tipobj.style.left="-1000px"
tipobj.style.backgroundColor=''
tipobj.style.width=''
}
}


function check_group_m(){
var nameValue = document.getElementById("groupid").value;
if(nameValue == 2){
document.getElementById("FIXED_TASKS").style.display = 'block';
}else{
document.getElementById("FIXED_TASKS").style.display = 'none';
}
}


    function CheckAll() {

      for (var i=0;i<document.form.elements.length;i++) {
        var e = document.form.elements[i];
        if ((e.name != 'allbox') && (e.type=='checkbox')) {
          e.checked = document.form.allbox.checked;
        }
      }

    }


function rejectallimages(){
for (var i=0;i<document.form.elements.length;i++) {
var e = document.form.elements[i];
if ((e.name != 'rejectall') && (e.type=='radio') && (e.value=='0') ) {
document.form.elements[i].checked=true;
}
}
document.form.downloadall.checked=false;
}

function downallimages(){
for (var i=0;i<document.form.elements.length;i++) {
var e = document.form.elements[i];
if ((e.name != 'rejectall') && (e.type=='radio') && (e.value > '0') ) {
document.form.elements[i].checked=true;
}
}
document.form.rejectall.checked=false;
}


function delimg_box(){
state = 'hidden';
showhide('desc_box')
showhide('desc_box1')
return false;
}

function cancel_delimg_box(){
state = 'visible';
showhide('desc_box')
showhide('desc_box1')
return false;
}


function checkEnter(e,id,value){ //e is event object passed from function invocation
var characterCode //literal character code will be stored in this variable

if(e && e.which){ //if which property of event object is supported (NN4)
e = e
characterCode = e.which //character code is contained in NN4's which property
}
else{
e = event
characterCode = e.keyCode //character code is contained in IE's keyCode property
}

if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
//document.forms[0].submit() //submit the form
xajax_process_flyedit_cat_name(id,value);
return false
}
else{
return true
}

}


function checkEnter2(e,memid,month,year,val){ //e is event object passed from function invocation
var characterCode //literal character code will be stored in this variable

if(e && e.which){ //if which property of event object is supported (NN4)
e = e
characterCode = e.which //character code is contained in NN4's which property
}
else{
e = event
characterCode = e.keyCode //character code is contained in IE's keyCode property
}

if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
//document.forms[0].submit() //submit the form
xajax_process_flyedit_total_rank(memid,month,year,val);
return false
}
else{
return true
}

}


function checkEnter3(e,memid,rule_id,month,year,val){ //e is event object passed from function invocation
var characterCode //literal character code will be stored in this variable

if(e && e.which){ //if which property of event object is supported (NN4)
e = e
characterCode = e.which //character code is contained in NN4's which property
}
else{
e = event
characterCode = e.keyCode //character code is contained in IE's keyCode property
}

if(characterCode == 13){ //if generated character code is equal to ascii 13 (if enter key)
//document.forms[0].submit() //submit the form
xajax_process_flyedit_this_rank(memid,rule_id,month,year,val);
return false
}
else{
return true
}

}



function j_xajax_The_AjaxSurvOpt(FormValues){
    myvar = '<img src="images/circle_animation.gif" />'
    div = "optdiv"
    document.getElementById(div).innerHTML=myvar
    xajax_The_AjaxSurvOpt(FormValues)
}




function j_xajax_ajax_getfullgalimg(fileid){
    myvar = '<img src="images/circle_animation.gif" />'
    div = "gall_main"
    document.getElementById(div).innerHTML=myvar
    xajax_ajax_getfullgalimg(fileid)
}


function j_xajax_play_svid(fileid){
    myvar = '<img src="images/circle_animation.gif" />'
    div = "vid_main"
    document.getElementById(div).innerHTML=myvar
    xajax_play_svid(fileid)
}

function setActiveTab(tabID) {
    var currTabElem = document.getElementById(tabID);
    currTabElem.setAttribute("class", "active");
    currTabElem.setAttribute("className", "active");

    return;
} 


function deActiveateTab(tabID) {
    var currTabElem = document.getElementById(tabID);
    currTabElem.setAttribute("class", "none");
    currTabElem.setAttribute("className", "none");

    return;
} 


function j_xajax_getnews(nct_id){
    myvar = '<img src="images/circle_animation.gif" />'
    div = "thenewscontent"
    document.getElementById(div).innerHTML=myvar
    //tabID = "anewssp"+nct_id

    //lastusedtab ="" 
    // thistabID = "anewssp"+mynewvar
    //deActiveateTab(thistabID)
    

    //setActiveTab(tabID)
    
    xajax_getnews(nct_id)
}



function getmyimg1(img)
{


        power = '<img src="../images/cat/' + img + '">'
        if(img == 0){
        document.getElementById('imgdiv').innerHTML = ''
         }else{
        document.getElementById('imgdiv').innerHTML = power
         }
        //document.scripts[0].src = power
}

