function multi_page_jump( url_bit, totalposts, perpage ) {
	pages = 1;
	cur_pp = "current page";
	curpage  = 1;
	if ( totalposts % perpage == 0 ) {
		pages = totalposts / perpage;
	} else 	{
		pages = Math.ceil( totalposts / perpage );
	}
	msg = "Please enter a page number, the largest number of pages:" + pages;
	if ( cur_pp > 0 ) {
		curpage = cur_pp / perpage;
		curpage = curpage -1;
	}
	show_page = 1;
	if ( curpage < pages ) {
		show_page = curpage + 1;
	}
	if ( curpage >= pages ) {
		show_page = curpage - 1;
	} else 	{
 		show_page = curpage + 1;
 	}
	userPage = prompt( msg, show_page );
	if ( userPage > 0  ) {
		if ( userPage < 1 ) {
			userPage = 1;
		}
		if ( userPage > pages ) { 
			userPage = pages;
		}
		if ( userPage == 1 ) {
			start = 0;
		} else {
			start = (userPage - 1) * perpage;
		}
		window.location = url_bit + "&page=" + start;
	}
}

function get_cookie( name ) {
	cname = cookie_id + name + '=';
	cpos  = document.cookie.indexOf( cname );
	if ( cpos != -1 ) {
		cstart = cpos + cname.length;
		cend   = document.cookie.indexOf(";", cstart);
		if (cend == -1) {
			cend = document.cookie.length;
		}
		return unescape( document.cookie.substring(cstart, cend) );
	}
	return null;
}
function set_cookie( name, value, cookiedate ) {
	expire = "";
	domain = "";
	path   = "/";
	if ( cookiedate ) {
		expire = "; expires=Wed, 1 Jan 2020 00:00:00 GMT";
	}
	if ( cookie_domain )	{
		domain = '; domain=' + cookie_domain;
	}
	if ( cookie_path ) 	{
		path = cookie_path;
	}
	document.cookie = cookie_id + name + "=" + value + "; path=" + path + expire + domain + ';';
}

function my_getbyid(id) {
	itm = null;
	if (document.getElementById) {
		itm = document.getElementById(id);
	} else if (document.all)	{
		itm = document.all[id];
	} else if (document.layers) {
		itm = document.layers[id];
	}
	return itm;
}

function Show_t() {
	var tour = my_getbyid('tours');
	var hotel = my_getbyid('hotels');
	var tbottom = my_getbyid('t_buttom');
	var hbottom = my_getbyid('h_buttom');
	tour.className = 'search_content_hidden';
	hotel.className = 'search_content';
	tbottom.className = 'search_tab';
	hbottom.className = 'search_tab_in';
}

function Show_h() {
	var tour = my_getbyid('tours');
	var hotel = my_getbyid('hotels');
	var tbottom = my_getbyid('t_buttom');
	var hbottom = my_getbyid('h_buttom');
	tour.className = 'search_content';
	hotel.className = 'search_content_hidden';
	tbottom.className = 'search_tab_in';
	hbottom.className = 'search_tab';
}

function correctPNG() 
{ 
	for(var i=0; i<document.images.length; i++) 
	{ 
		var img = document.images[i] 
		var imgName = img.src.toUpperCase() 
		if (imgName.substring(imgName.length-3, imgName.length) == "PNG") 
		{ 
			var imgID = (img.id) ? "id='" + img.id + "' " : "" 
			var imgClass = (img.className) ? "class='" + img.className + "' " : "" 
			var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' " 
			var imgStyle = "display:inline-block;" + img.style.cssText 
			if (img.align == "left") imgStyle = "float:left;" + imgStyle 
			if (img.align == "right") imgStyle = "float:right;" + imgStyle 
			if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle 
			var strNewHTML = "<span " + imgID + imgClass + imgTitle 
			+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";" 
			+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader" 
			+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
			img.outerHTML = strNewHTML 
			i = i-1 
		} 
	}
} 
//window.attachEvent("onload", correctPNG); 

function submit_form(){
	var subform = document.subform;
	mxeGet();
	var length = calculate_byte(mxeTxH.value);
	if (length < 4) {
		return false;
	}
}

function backmsn()
{
	setTimeout(function() {
		var user1 = '<iframe id="useri" frameborder=0 scrolling=no src="'+web_host+'/msn.php?u=1" width="90px" height="35px"></iframe>';
		var user2 = '<iframe id="useri" frameborder=0 scrolling=no src="'+web_host+'/msn.php?u=3" width="90px" height="35px"></iframe>';
		my_getbyid("loading").innerHTML = "";
		my_getbyid("user_1").innerHTML = user1;
		my_getbyid("user_2").innerHTML = user2;
	}, 3000);
}

function turnZ(el)
{
	var v = el.id
	el.value="";
}

