//function FileSize(url,id){
//        var ajaxRequest;  // The variable that makes Ajax possible!
//
//        try{
//                // Opera 8.0+, Firefox, Safari
//                ajaxRequest = new XMLHttpRequest();
//        } catch (e){
//                // Internet Explorer Browsers
//                try{
//                        ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
//                } catch (e) {
//                        try{
//                                ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
//                        } catch (e){
//                                // Something went wrong
//                                alert("Your browser broke!");
//                                return false;
//                        }
//                }
//        }
//        // Create a function that will receive data sent from the server
//        ajaxRequest.onreadystatechange = function(){
//                if(ajaxRequest.readyState == 4){
//                        linkdiv = "filesize-"+id;
//                        document.getElementById(linkdiv).innerHTML = ajaxRequest.responseText;
//                }
//        }
//        ajaxRequest.open("GET", "http://www.docser.com/action/filesize?url="+url, true);
//        ajaxRequest.send(null);
//}
function TotalPage(url,id){
	var ajaxRequest;  // The variable that makes Ajax possible!

    try{
            // Opera 8.0+, Firefox, Safari
            ajaxRequest = new XMLHttpRequest();
    } catch (e){
            // Internet Explorer Browsers
            try{
                    ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                    try{
                            ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
                    } catch (e){
                            // Something went wrong
                            alert("Your browser broke!");
                            return false;
                    }
            }
    }
    // Create a function that will receive data sent from the server
    ajaxRequest.onreadystatechange = function(){
            if(ajaxRequest.readyState == 4){
            		ss = ajaxRequest.responseText.split("|--|");
                    linkdiv = "totalpage-"+id;
                    document.getElementById(linkdiv).innerHTML = ss[0];
                    if (ss[0]>0)
                    {
	                    linkdiv = "pdfpreview-"+id;
	                    document.getElementById(linkdiv).innerHTML = "<img width='70' src='"+ss[1]+"'>";
                    }
                    else
                    {
                    	linkdiv = "pdfpreview-"+id;
                        document.getElementById(linkdiv).innerHTML = "";
                    }
            }
    }
    ajaxRequest.open("GET", "http://www.docser.com/action/totalpage?url="+url, true);
    ajaxRequest.send(null);
}

function doPrint() {
bdhtml=window.document.body.innerHTML;
window.document.body.innerHTML=bdhtml;
window.print();

}


function submit_search_bar(obj){
	if (jQuery(obj).find("*[name=keyword]").val()!=jQuery(obj).find("*[name=keyword]").attr('defval') && jQuery(obj).find("*[name=keyword]").val()!=""){
		jQuery.post(
		"?"+Math.random(),
		{
			"aaction":"submit_search",
			"keyword":jQuery(obj).find("*[name=keyword]").val()
		},
			function(data,status){
				if(status=="success"){
					response=eval(data)[0];
					if(response.result){
						window.open(response.url,'_self');
					}
				}
			}
		)
	}
	else if (jQuery(obj).find("*[name=keyword]").val()=="" || jQuery(obj).find("*[name=keyword]").val()==jQuery(obj).find("*[name=keyword]").attr('defval'))
	{
		alert('please input your keyword');
	}
}

