
// Check Box Select/Toggle Functions for Select/Toggle All


function validateForm(form)
{
    if (form.campaignParentServiceId.value=="" || isNull(form.campaignParentServiceId.value))
    {
        alert("Please enter the role performed by the supplier during the event");
        return false;
    }
    return true;
}

function cForm(form)
{
 var height = screen.height - 150;
 var width  = screen.width - 300;
 win=window.open('','ownListing','width=' + width + ', height=' + height +', toolbars=0, location=0, scrollbars=1');
 form.target='ownListing';
}

function popupOwnListing(url)
{
    var height = screen.height - 150;
    var width  = screen.width - 300;
    win=window.open(url,'ownListing','width=' + width + ', height=' + height +', toolbars=0, scrollbars=1');   
}


function toggle(e) {
    e.checked = !e.checked;    
}
function checkToggle(e) {
    var cform = document.selectAllForm;
    if (e.checked) {      
        var len = cform.elements.length;
        var allchecked = true;
        for (var i = 0; i < len; i++) {
            var element = cform.elements[i];
            if (element.name.substring(0, 10) == "_rowSubmit" && !element.checked) {       
                allchecked = false;
            }
            cform.selectAll.checked = allchecked;            
        }
    } else {
        cform.selectAll.checked = false;
    }
}
function toggleAll(e) {
    var cform = document.selectAllForm;
    var len = cform.elements.length;
    for (var i = 0; i < len; i++) {
        var element = cform.elements[i];                   
        if (element.name.substring(0, 10) == "_rowSubmit" && element.checked != e.checked) {
            toggle(element);
        } 
    }     
}
function selectAll() {
    var cform = document.selectAllForm;
    var len = cform.elements.length;
    for (var i = 0; i < len; i++) {
        var element = cform.elements[i];                   
        if ((element.name == "selectAll" || element.name.substring(0, 10) == "_rowSubmit") && !element.checked) {
            toggle(element);
        } 
    }     
}
function removeSelected() {
    var cform = document.selectAllForm;
    cform.removeSelected.value = true;
    cform.submit();
}

// popup windows functions

function popUp(url, name, height, width) {
    popupWindow = window.open(url, name, 'location=no,scrollbars=yes,width=' + width + ',height=' + height);

}
function popUpSmall(url, name) {
    popUp(url, name, '300', '450');

}

function popUpMedium(url, name) {
    popUp(url, name, '590', '590');

}

function popUpLarge(url, name) {
    popUp(url, name, '650', '850');

}

// hidden div functions

function getStyleObject(objectId) {
    if (document.getElementById && document.getElementById(objectId)) {
        return document.getElementById(objectId).style;
    } else if (document.all && document.all(objectId)) {
        return document.all(objectId).style;
    } else if (document.layers && document.layers[objectId]) {
        return document.layers[objectId];
    } else {
        return false;
    }
}
function changeObjectVisibility(objectId, newVisibility) {
    var styleObject = getStyleObject(objectId);
    if (styleObject) {
        styleObject.visibility = newVisibility;
        return true;
    } else {
        return false;
    }
}

    function P7_colH2(){ //v2.1.0 by PVII-www.projectseven.com
     var i,oh,h=0,tg,el,np,dA=document.p7eqc,an=document.p7eqa;if(dA&&dA.length){

     for(i=1;i<dA.length;i+=2){dA[i+1].style.paddingBottom='';}for(i=1;i<dA.length;i+=2){
     oh=dA[i].offsetHeight;h=(oh>h)?oh:h;}for(i=1;i<dA.length;i+=2){oh=dA[i].offsetHeight;
     if(oh<h){np=h-oh;if(!an&&dA[0]==1){P7_eqA2(dA[i+1].id,0,np);}else{
     nr = (np - 175);
     if(nr >= 0){nr=nr;}else{nr=0;}
     dA[i+1].style.paddingBottom=nr+"px";}}}document.p7eqa=1;
     document.p7eqth=document.body.offsetHeight;
     document.p7eqtw=document.body.offsetWidth;}
    }


    function P7_eqT2(){ //v2.1.0 by PVII-www.projectseven.com
     if(document.p7eqth!=document.body.offsetHeight||document.p7eqtw!=document.body.offsetWidth)
     {P7_colH2();}
    }



    function P7_eqT2(){ //v2.1.0 by PVII-www.projectseven.com
     if(document.p7eqth!=document.body.offsetHeight||document.p7eqtw!=document.body.offsetWidth)
     {P7_colH2();}
    }

    function P7_equalCols2(){ //v2.1.0 by PVII-www.projectseven.com
     var c,e,el;if(document.getElementById){document.p7eqc=new Array();
     document.p7eqc[0]=arguments[0];for(i=1;i<arguments.length;i+=2){el=null;
     c=document.getElementById(arguments[i]);if(c){e=c.getElementsByTagName(arguments[i+1]);
     if(e){el=e[e.length-1];if(!el.id){el.id="p7eq"+i;}}}if(c&&el){
     document.p7eqc[document.p7eqc.length]=c;document.p7eqc[document.p7eqc.length]=el}}
     setInterval("P7_eqT2()",10);}
    }

    function P7_eqA2(el,p,pt){ //v2.1.0 by PVII-www.projectseven.com
     var sp=10,inc=20,g=document.getElementById(el);np=(p>=pt)?pt:p;
     g.style.paddingBottom=np+"px";if(np<pt){np+=inc;
     setTimeout("P7_eqA2('"+el+"',"+np+","+pt+")",sp);}
    }
