/************************************************
	Description: common script
************************************************/

function smartRollover() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("img");
		
		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src").match("_off."))
			{
				images[i].onmouseover = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
				}
				images[i].onmouseout = function() {
					this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
				}
			}
		}
	}
}

function inputChange() {
	if(document.getElementsByTagName) {
		var images = document.getElementsByTagName("input");
		for(var i=0; i < images.length; i++) {
			if(images[i].getAttribute("src")){
				if(images[i].getAttribute("src").match("_off."))
				{
					images[i].onmouseover = function() {
						this.setAttribute("src", this.getAttribute("src").replace("_off.", "_on."));
					}
					images[i].onmouseout = function() {
						this.setAttribute("src", this.getAttribute("src").replace("_on.", "_off."));
					}
				}
			}
		}
	}
}

if(window.addEventListener) {
	window.addEventListener("load", smartRollover, false);
	window.addEventListener("load", inputChange, false);
	window.addEventListener("load", SideChildOver, false);
}
else if(window.attachEvent) {
	window.attachEvent("onload", smartRollover);
	window.attachEvent("onload", inputChange);
	window.attachEvent("onload", SideChildOver);
}

/************************************************
	sidemenu
************************************************/

function SideChildOver()
{
	if(document.getElementsByTagName)
	{
		var uls = document.getElementsByTagName("a");
		for(var i=0;i<uls.length;i++)
		{
			if((uls[i].getAttribute("class")||uls[i].getAttribute("className")) == 'side_child')
			{
				uls[i].onmouseover = function()
				{
					this.parentNode.style.backgroundColor = "#d5d5d5";
				}

				uls[i].onmouseout = function()
				{
					if(this.parentNode.getAttribute('id') != 's_position')
					{
						this.parentNode.style.backgroundColor = "#f7f7f7";
					}
				}

			}
		}
	}
}

/************************************************
	Flash loader
************************************************/

	var flashvars = null;
	var params = {	wmode:"transparent"	};
	var attributes = null;

function loadSwf(movie)
{
	swfobject.embedSWF(movie, "bkg_flash", "100%", "111", "9.0.0", null , flashvars , params , attributes);
}

function loadTop(movie)
{
	swfobject.embedSWF(movie, "top_flash", "780", "188", "9.0.0", null , flashvars , params , attributes);
}


/************************************************
	text size
************************************************/

function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);

/*--------------------------------------------------------------------------
 *  Smooth Scroller Script, version 1.0.1
 *  (c) 2007 Dezinerfolio Inc. <midart@gmail.com>
 *
 *  For details, please check the website : http://dezinerfolio.com/
 *
/*--------------------------------------------------------------------------*/

Scroller = {
	// control the speed of the scroller.
	// dont change it here directly, please use Scroller.speed=50;
	speed:10,

	// returns the Y position of the div
	gy: function (d) {
		gy = d.offsetTop
		if (d.offsetParent) while (d = d.offsetParent) gy += d.offsetTop
		return gy
	},

	// returns the current scroll position
	scrollTop: function (){
		body=document.body
	    d=document.documentElement
	    if (body && body.scrollTop) return body.scrollTop
	    if (d && d.scrollTop) return d.scrollTop
	    if (window.pageYOffset) return window.pageYOffset
	    return 0
	},

	// attach an event for an element
	// (element, type, function)
	add: function(event, body, d) {
	    if (event.addEventListener) return event.addEventListener(body, d,false)
	    if (event.attachEvent) return event.attachEvent('on'+body, d)
	},

	// kill an event of an element
	end: function(e){
		if (window.event) {
			window.event.cancelBubble = true
			window.event.returnValue = false
      		return;
    	}
	    if (e.preventDefault && e.stopPropagation) {
	      e.preventDefault()
	      e.stopPropagation()
	    }
	},
	
	// move the scroll bar to the particular div.
	scroll: function(d){
		i = window.innerHeight || document.documentElement.clientHeight;
		h=document.body.scrollHeight;
		a = Scroller.scrollTop()
		if(d>a)
			if(h-d>i)
				a+=Math.ceil((d-a)/Scroller.speed)
			else
				a+=Math.ceil((d-a-(h-d))/Scroller.speed)
		else
			a = a+(d-a)/Scroller.speed;
		window.scrollTo(0,a)
	  	if(a==d || Scroller.offsetTop==a)clearInterval(Scroller.interval)
	  	Scroller.offsetTop=a
	},
	// initializer that adds the renderer to the onload function of the window
	init: function(){
		Scroller.add(window,'load', Scroller.render)
	},

	// this method extracts all the anchors and validates then as # and attaches the events.
	render: function(){
		anc_list = document.getElementsByTagName('a');
		for(var t=0 ; t<anc_list.length ; t++){
			if((anc_list[t].getAttribute('class')||anc_list[t].getAttribute('className')||anc_list[t].getAttribute('id')) == 'totop_a')
			{
				Scroller.end(this);
				window.onscroll
					Scroller.add(anc_list[t],'click',Scroller.end)
					anc_list[t].onclick = function(){
					Scroller.end(this);
					l=this.hash.substr(1);
					a = document.getElementsByTagName('a');
					for (i=0;i<a.length;i++) {
						if(a[i].name == l){
							clearInterval(Scroller.interval);
							Scroller.interval=setInterval('Scroller.scroll('+Scroller.gy(a[i])+')',10);
						}
					}
				}
			}
		}
	}
}
// invoke the initializer of the scroller
Scroller.init();

/*------------------------------------------------------------
 *						END OF CODE
/*-----------------------------------------------------------*/

function gotoCalender()
{
	var date = new Date();
	var year = date.getFullYear();
	var year = year+"";
	var yy = year.substring(2,4);
	var month = date.getMonth() + 1;
	if (month < 10) {
		month = "0" + month;
	}else{
		month = month + "";
	}

	switch(month){
	case "01": case "02": case "03":
		location.href="/medical/conf_calendar/"+yy+"01_03.html";
		break;
	case "04": case "05": case "06":
		location.href="/medical/conf_calendar/"+yy+"04_06.html";
		break;
	case "07": case "08": case "09":
		location.href="/medical/conf_calendar/"+yy+"07_09.html";
		break;
	case "10": case "11": case "12":
		location.href="/medical/conf_calendar/"+yy+"10_12.html";
		break;
	default:
	break;
	}
}

/************************************************
	TOP PAGE swf/img changer
************************************************/

function checkCount(url,type)
{
	loadTop(url);
}

