// Nguyen Thanh Binh - 0923.686.993 - Thanhbinh101287@gmail.com - Y!M: Thanhbinh101287

function loadDefault()
{
	if($('.menu_left').length==0)
		$('.content_center').css({'width' : '754px','margin':'0'});
	selected();
	Weblink('slWeblink');
}

function Weblink(where)
{
	$('#'+where).change(function(){
		if($(this).val()!="")
			window.open($(this).val(), '_blank');
	});
}

function selected()
{
	$("select").each(function(){
		var title = $(this).attr("title").split(',');
		$(this).find("option").each(function(){
			for(i=0;i<title.length;i++)
				if($(this).val()==title[i])
					$(this).attr("selected","selected");
		});
	});
	//$('html, body').animate({scrollTop: $(document).height()}, 1000).animate({scrollTop: '0px'}, 500);
}

function City(code)
{
	var optionIndex = 1;
	document.getElementById('slDistrict').length=1;
	for(i=0;i<=jCity.length;i++)
	{
		if(jCity[i]==code)
		{
			var optionname = new Option(jCityName[i], jDistrict[i]); 
			document.getElementById('slDistrict').options[optionIndex]=optionname;
			optionIndex++;
		}
	}
}

function scrollTop()
{
	$('#btnTop').click(function() {
		$('html, body').animate({scrollTop: '0px'}, 500);
		return false;
	});
}
function popup(url,name,windowWidth,windowHeight){
    var myleft=(screen.width)?(screen.width-windowWidth)/2:100;
	var mytop=(screen.height)?(screen.height-windowHeight)/2:100;
	var properties = "width="+windowWidth+",height="+windowHeight+",scrollbars=yes, top="+mytop+",left="+myleft;
    var newwindow = window.open(url,name,properties);
}
