<!--

function MailCheckAll() {
    for( i = 0; i < document.email.elements.length; i ++ ) {
        if( document.email.elements[i].type == "checkbox" ) {
            document.email.elements[i].checked = true;
        }
    }
}

function MailUncheckAll() {
    for( i = 0; i < document.email.elements.length; i ++ ) {
        if( document.email.elements[i].type == "checkbox" ) {
            document.email.elements[i].checked = false;
        }
    }
}

function rowbg(obj, clr){
    obj.style.cursor='pointer';
    obj.style.backgroundColor=clr;
}
function warna1( obj ){
    /*obj.style.backgroundColor='#8B008B';*/
    obj.style.backgroundColor='#FFFFAA';
}

function warna2( obj ){
    obj.style.backgroundColor='#FFFFFF';
}

function warna3( obj ){
    obj.style.backgroundColor='#EDEDED';
}

function ChangeIdspl ( form ){
    var newIndex = form.idsupp.selectedIndex;
    //if ( newIndex == 0 ) {
    //window.location.form.idsupp.options[ newIndex ].value;
    //} else {
    cururl = form.idsupp.options[ newIndex ].value;
    window.location.assign( cururl );
//}
//document.location="?content=vprdspl&idspl=" + this.value;
}

function ChangePageSearchPremium( value, comp, sort, order, food ) {
    obj = document.getElementsByName(comp);
    obj = obj[0];
    document.location="?content=result_premium&formPage=2&type="+ food + "&page=" + obj.value + "&sort=" + sort + "&order=" + order;
}

function ChangePageSearchPremium1( value, comp, sort, order, food ) {
    obj = document.getElementsByName(comp);
    obj = obj[0];
    document.location="?content=result_premium&type=" + value + "&formPage=2&page=" + obj.value + "&sort=" + sort + "&order=" + order;
}

function ChangePageSearchPremium2( value, comp, sort, order, food ) {
    obj = document.getElementsByName(comp);
    obj = obj[0];
    arrvalue=value.split(",")
    document.location="?content=result_premium&location=" + arrvalue[1] + "&type=" + arrvalue[0] + "&formPage=2&page=" + obj.value + "&sort=" + sort + "&order=" + order;
}

function ChangePageSearch( value, comp, sort, order ) {
    obj = document.getElementsByName(comp);
    obj = obj[0];
    document.location="?content=result&page=" + obj.value + "&sort=" + sort + "&order=" + order;
}

function ChangePageSearch1( value, comp, sort, order ) {
    obj = document.getElementsByName(comp);
    obj = obj[0];
    document.location="?content=result&type=" + value + "&page=" + obj.value + "&sort=" + sort + "&order=" + order;
}

function ChangePageSearch2( value, comp, sort, order ) {
    obj = document.getElementsByName(comp);
    obj = obj[0];
    document.location="?content=result&menu=" + value + "&page=" + obj.value + "&sort=" + sort + "&order=" + order;
}

function ChangePageSearch3( value, comp, sort, order ) {
    obj = document.getElementsByName(comp);
    obj = obj[0];
    document.location="?content=result&rest=" + value + "&page=" + obj.value + "&sort=" + sort + "&order=" + order;
}

function ChangePageSearch4( value, comp, sort, order ) {
    obj = document.getElementsByName(comp);
    obj = obj[0];
    document.location="?content=result&area=" + value + "&page=" + obj.value + "&sort=" + sort + "&order=" + order;
}

function ChangePageSearch5( value, comp, sort, order ) {
    obj = document.getElementsByName(comp);
    obj = obj[0];
    document.location="?content=result&location=" + value + "&page=" + obj.value + "&sort=" + sort + "&order=" + order;
}

function EditNoAnchor( content, id ) {
    document.location="?content=" + content + "&action=edit&id=" + id + "";
}

function Edit( content, id ) {
    document.location="?content=" + content + "&action=edit&id=" + id + "#aedit";
}

function EditMeta( id ) {
    document.location="?action=edit&id=" + id + "#aedit";
}

function View( content, id ) {
    document.location="?content=" + content + "&action=view&id=" + id;
}

function ViewMeta( id ) {
    document.location="?content=" + id;
}

function previewCode() {
    var obj = document.getElementById("divpreview");
    var code = document.getElementsByName("Code");
    code = code[0];
    obj.innerHTML = code.value;

}

function ChangeGroup( content, id ) {
    document.location="?content=" + content + "&action=cgroup&id=" + id;
}

// add by chanadh
function trim(str){
	   return str.replace(/^\s+|\s+$/g,'');
}

// add a value from textbox to listbox/dropdownlist
// source name : input text box
// dest_nane   : listbox or dropdown
// limit4add   : limitation lines allowed
function add2listbox(source_name,dest_name,limit4add){

    var opt = document.createElement("option");
    var srce = document.getElementById(source_name);
    var dest = document.getElementById(dest_name);

    if (trim(srce.value)=='') return;

    // count lines
    // limit in 500 lines maximum
    if (dest.options.length <= (limit4add-1)){
        // Add an Option object to Drop Down/List Box
        dest.options.add(opt);
        // Assign text and value to Option object
        opt.text = srce.value;
        opt.value = srce.value;
        // clear textbox
        srce.value = '';
        // set focus back into source control
        srce.focus();
    } else {
        alert('Sorry, only ' + dest.options.length + ' lines can be added.' +
            '\nYou may use Upload for adding more than '+dest.options.length+' lines.');
        srce.value = '';
    }
}

// clear all list on listbox/dropdownlist
function cclear(_name){
    document.getElementById(_name).innerHTML='';
}

// clear only 1 list on listbox/dropdownlist
function cclear1(_name){
    var x=document.getElementById(_name);
    x.remove(x.selectedIndex);
}

-->
