﻿// JScript 파일
var xhr = null;

$( function() {
    /**
    _url = "/Collection/Designer.aspx"
    _param = {
		designerIdx : 34,
		sort : 'title',
		displaynum : 5,
		pagenum : 1,
		gtype:1
	};
	_id = "divDesigner"
	_display = true
    **/

    callAjaxService = function(_url, _param, _id, _blockUI, _display) {
	    //이미 실행중인 Ajax stop
	    if(xhr != null) {
		    xhr.abort();
	    }
	    xhr = $.ajax( {
		    url : _url,
		    cache : false,
		    dataType : "html",
		    data : _param,
		    error : function(message) {
			    alert('Error => ' + message);
		    },
		    success : function(data) {    			
			    $("#" + _id).html(data.trim());			    
			    if(_blockUI){
			        $("#" + _id).attr("style", "width:100%");
				    $.blockUI({ 
		                message: $("#" + _id),
		                ie6height : 200,
		                css :{top:'20%'}, 
		                overlayCSS : {width:'100%'}
		             });
			    }	
			    if(_display){
				    $("#" + _id).show("slow");
			    }
		    }
	    });
    	
    }
    
    callAjaxService2 = function(_url, _param, _id, _blockUI, _display) {
	    xhr = $.ajax( {
		    url : _url,
		    cache : false,
		    dataType : "html",
		    data : _param,
		    error : function(message) {
			    alert('Error => ' + message);
		    },
		    success : function(data) {    			
			    $("#" + _id).html(data.trim());			    
			    if(_blockUI){
			        $("#" + _id).attr("style", "width:100%");
				    $.blockUI({ 
		                message: $("#" + _id),
		                ie6height : 200,
		                overlayCSS : {width:'100%'}
		             });
			    }	
			    if(_display){
				    $("#" + _id).show("slow");
			    }
		    }
	    });
    	
    }
    doCloseLayer = function() {
    	$.unblockUI();
        $(".closeLayer").hide();
        $('html,body').css('height', '');
        $("#divLayer").attr("style", "height:0px");
    }
});

function remoteCall(url)
{
    var xmlhttp = null;
    var responseText = "";

    if(window.XMLHttpRequest) 
    {
        xmlhttp = new XMLHttpRequest();
    } 
    else 
    {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
    }

    xmlhttp.open('GET', url, false);
    xmlhttp.onreadystatechange = function() 
    {
        if(xmlhttp.readyState==4 && 
            xmlhttp.status == 200 && 
            xmlhttp.statusText == 'OK'
         ) 
        {
            responseText = xmlhttp.responseText;
        }
    }

    xmlhttp.send('');
		  
    return responseText;
}