function parseURL(strParamName)
	{ var strReturn = "";
	var strHref = window.location.search;//window.location.href;
		if ( strHref.indexOf("?") > -1 )
				{ 
					var strQueryString = strHref.substr(1);
					var aQueryString = strQueryString.split("&");
						for (var i=0; i<aQueryString.length; i++)
							{ var aParam = aQueryString[i].split("=");
								if (aParam[0]==strParamName)
									{ strReturn = aParam[1];
									break;
										}
							}
				}
		return unescape(strReturn);
	}
function $() {
     var elements = new Array();
    	for (var i = 0; i < arguments.length; i++) {
         		var element = arguments[i];
         		if (typeof(element) == 'string')
             			element = document.getElementById(element);
         		if (arguments.length == 1)
             			return element;
         		elements.push(element);
    	}
    	return elements;
}

function getStart2Next()
{
	var oPage;
	if(parseInt($('started').value)==1){ 
		oPage=2; 
	}
	else{ 
		oPage=parseInt($('started').value)+1;
	}
	return oPage;
}

var NumRecord = 3;
//$('started').value=5;
var Iist=parseInt($('started').value);
var Iend = (Iist-1)+NumRecord;
if(Iist==0) { Iist=12; Iend=14; }
var curRecord = 3;
var step=1;
var debug = false;
var 	MaxRecord=15;
changeAppearance();
change_classname();

function showPrev() {
	Iist -= step;
	Iend -= step;
	if (debug) alert("Iist = " + Iist + " and Iend = " + Iend);
	//alert(Iist);
	//if(Iist==2) { Iist=13; Iend=15; }
	//else if(Iist==0) { Iist=12; Iend=14; }
	if(Iist==0) { Iist=12; Iend=14; }
	curRecord = Iist;
	$('started').value=''+Iist;
	changeAppearance();
	change_classname();	
}

function showNext() {
	Iist += step;
	Iend += step;

	if(Iist==14) { Iist=2; Iend=4; }

	if (Iend >= MaxRecord) {
		Iist = MaxRecord - 2; 
		Iend = MaxRecord;
	}

	curRecord = Iist;
	$('started').value=''+Iist;
	changeAppearance();
	change_classname();
	if (debug) alert("Iist = " + Iist + " and Iend = " + Iend);
	
}

function change_classname()
{
	for(i=1;i<=MaxRecord;i++){			
		if(i==(Iist+Iend)/2)
		{
			$("objSpan"+i).className='monthlist active';	
			var language_tourhot = parseURL('l');
			if(language_tourhot=='')
			{
				language_tourhot='2';
			}			
			//changepage(i%12 + '&l=' + language_tourhot);	
			var _temp=(Iist+Iend)/2;
			if (_temp==13)
			{
				_temp=1;
			}
			if (_temp==14)
			{
				_temp=2;
			}			
			changepage(_temp + '&l=' + language_tourhot);		
		}
		else
		{
			$("objSpan"+i).className='monthlist normal';
		}
	}
	//alert((Iist+Iend)/2);
}
function click_month(_month)
{
	if (_month>(Iist+Iend)/2)
	{
		showNext();
	}
	else
	{
		showPrev();
	}
}
function changeAppearance() {
	for(i=1;i<=MaxRecord;i++){
		if (i >= Iist && i <= Iend){ 
			$("objSpan"+i).style.display = "block";			
		}else {
			$("objSpan"+i).style.display = "none";	
		}
	}	
}