$(document).ready(function() { 
    $('#pc').ajaxForm({
        beforeSubmit: function(a,f,o) {
			$('#loading1').html('<br><center><img src="i/loading.gif" /></center><br>').fadeIn('slow');
        },
        success: function(data) {
            var $out = $('#page');
            $out.html('');
            if (typeof data == 'object' && data.nodeType)
                data = elementToString(data.documentElement, true);
            else if (typeof data == 'object')
                data = objToString(data);
            $out.append(''+ data +'');
        }
    });

    $('#url').ajaxForm({
        beforeSubmit: function(a,f,o) {
			$('#loading2').html('<br><center><img src="i/loading.gif" /></center><br>').fadeIn('slow');
        },
        success: function(data) {
            var $out = $('#page');
            $out.html('');
            if (typeof data == 'object' && data.nodeType)
                data = elementToString(data.documentElement, true);
            else if (typeof data == 'object')
                data = objToString(data);
            $out.append(''+ data +'');
        }
    });
}); 


function showfile()
{
    var countfld=1;
    countfld=document.getElementById("countfld").value+countfld;
    fld=countfld.length;
    if(fld>9)
    {
    alert("Sorry, i can upload  max 10 images at once.");    
    return false;
    }
    else
    {
        document.getElementById("f"+fld).style.display="block";
        document.getElementById("countfld").value=countfld;
    }    
}

function showfileu()
{
    var countfld=1;
    countfld=document.getElementById("countfldu").value+countfld;
    fld=countfld.length;
    if(fld>9)
    {
    alert("Sorry, i can upload  max 10 images at once.");    
    return false;
    }
    else
    {
        document.getElementById("u"+fld).style.display="block";
        document.getElementById("countfldu").value=countfld;
    }    
}

function uploadfile(id)
{
    if(document.getElementById(id).value==1)
    {
    document.getElementById("showurl").style.display="none";
    document.getElementById("showfl").style.display="block";        
    return true;
    }
    if(document.getElementById(id).value==2)
    {
    document.getElementById("showfl").style.display="none";
    document.getElementById("showurl").style.display="block";    
    return true;
    }
    document.getElementById("countfldu").value="0";
    document.getElementById("countfld").value="0";
    

}