﻿// JScript File

function loadContent (url) {
	$("div#htmlContent").html ( '<div style="padding: 190px 0px 199px 0px; text-align: center; width: 100%; height: 100%;"><img src="../images/ajax-loader.gif" /></div>' );
	$('div#htmlContent').load( url );
}


function bindEvent() {

	$("div#sDocTop a").click(function () {
		this.blur();
		//loadContent( $(this).attr("href"));
		currPage = parseInt($("div#dvDocList select").attr("value"));
		if ( $(this).attr("id") == "npt2" ) 
		    currPage += 1;
		else if ( $(this).attr("id") == "npt1" ) 
		    currPage -= 1;
		if (currPage < 0) currPage = 1;
		loadContent( "Searchth.aspx?Page="+currPage+"&sN="+escape($('#hsN').attr('value'))+"&sD="+$('#hsD').attr('value')+"&sDay="+$('#hsDay').attr('value'));
		return false;
	});
	$("div#sDocBot a").click(function () {
		this.blur();
		//loadContent( $(this).attr("href"));
		currPage = parseInt($("div#dvDocList select").attr("value"));
		if ( $(this).attr("id") == "npb2" ) 
		    currPage += 1;
		else if ( $(this).attr("id") == "npb1" ) 
		    currPage -= 1;
		if (currPage < 0) currPage = 1;
		loadContent( "Searchth.aspx?Page="+currPage+"&sN="+escape($('#hsN').attr('value'))+"&sD="+$('#hsD').attr('value')+"&sDay="+$('#hsDay').attr('value'));
		return false;
	});	
	
	
	$("div#dvDocList select").change(function () {
		this.blur();
		loadContent( "Searchth.aspx?Page="+$(this).attr("value")+"&sN="+escape($('#hsN').attr('value'))+"&sD="+$('#hsD').attr('value')+"&sDay="+$('#hsDay').attr('value'));
		return false;
	});	
	
}


$("div#dvSearch a").click(function () {
	this.blur();
	loadContent( $(this).attr("href")+"&sN="+escape($('#ctl00_ctl00_cph_cphDoctor_txtName').attr('value'))+"&sD="+$('#ctl00_ctl00_cph_cphDoctor_ddlDep').attr('value')+"&sDay="+$('#ctl00_ctl00_cph_cphDoctor_ddlDay').attr('value'));
	
	return false;
});		

