function getAttributesByCategory(){
    var categoryId = $F('ctl00_contentMainLeft_txtCategoryBase');
    new Ajax.Request(
        "Register.aspx",
        {
            parameters: "GetAttrByCat="+categoryId,
            onSuccess: setCategoryAttributes
        }
    );
}

//Event.observe(
//    window,
//    'load',
//    getAttributesByCategory
////    function(){
////        alert("test");
////    }
//); 

function setCategoryAttributes(x){    
    var response=x.responseText;
    var data=eval("("+response+")");
    
    var attrs = $$('div.DetailGridFieldLine input.field_medium2');
    attrs.each(function(x){
        if($F('compId')=='')
            x.clear();
    });
        
    var divs = $$('div.DetailGridFieldLine');
    divs.each(function(x){
        x.hide();
    });

    for(var i=0;i<data.attributes.length;i++){
        var d=data.attributes[i];
        var o=data.ordinals[i];
        var j= i+1;
        if (d.length>0){
            if(parseInt(o)>=1 && parseInt(o)<=5)
                j = parseInt(o);
            $('ctl00_contentMainLeft_att'+j.toString()).innerHTML = d;
            $('ctl00_contentMainLeft_divAtt'+j.toString()).show();
        }
    }

    if(data.attributes.length==0){
        Element.hide('dvCategoryAttributes');
    }
    else
        Element.show('dvCategoryAttributes');
            
}

//function chkAttributes(){
//    Element.show('dvCategoryAttributes');
//}

function checkClaimStatus(claimStat){
    if(claimStat==1 || claimStat==2){
        $('dvMainLeft').removeClassName('Shadow');
        $('dvRegInfo').removeClassName('DetailGrid');
        $('dvRegInfo').addClassName('DetailGridClaimListing');
                
        if(claimStat==2){
            Modalbox.show($('loginClaimed'), {title: 'Claim Listing', width: 400});
        }
    }
    
}

function LoginUpdateClaimed(enzourl){
    window.open(enzourl);
    self.close();
}


function DisableButton() {
    document.forms[0].submit();
    window.setTimeout("disableButton('" + 
       window.event.srcElement.id + "')", 0);
}

function disableButton(buttonID) {
    $(buttonID).disabled=true;
}

function validateSubmit0(){
    if ( typeof( Page_ClientValidate ) == 'function' ) 
    { 
        if ( ! Page_ClientValidate() ) {return false; } 

    } 
    $('ctl00_contentMainLeft_btnSubmit').disabled = true; 
}
function validateSubmit(){
    if ( typeof( Page_ClientValidate ) == 'function' ) { if ( ! Page_ClientValidate() ) { return false; } } 
    $('ctl00_contentMainLeft_btnSubmit').disabled = true;
    __doPostBack('ctl00$contentMainLeft$btnSubmit','');
    return true;
}

