// JavaScript Document
Sidebar = {};
var orderStr;
$(function(){

//	$('#areaList span').click(function(){	   
//		changeCityCatalog(this.innerHTML,'City');
//	});
		   
	//Overlay();
	//Prepare();	

//	$('#Feedback').click(function(){
//			
//			$('#overlay').fadeIn();
//			$('#FeedBackTable').fadeIn();						  
//	});
	
})


function Order(types){
	window.location.href = types;
/*	var hostname = "http://"+document.domain+"/";
	if(document.domain == "localhost"){
		hostname = location.href;
	}
	$.ajax({
		type : "GET",
		url : hostname + types,
		beforeSend : function(){
			$('#overlay').fadeIn();
			$('#box').fadeIn();
		},
		success : function(html){
			$('#overlay').fadeOut();
			$('#box').hide();
			$('#center_left').empty().append(html);
			$('#center_left').append('<div class="clear"></div>');
		},
		error : function(){
			
			$('#overlay').fadeOut();
			$('#box').hide();
		}
	})*/

}

function doPageNum(num){
	var hostName = document.location.href;
	for(i in hostName){
		if(hostName[i] == '?'){
			hostName = hostName.substr(0,i-1);	
		}	
	}
	var url = hostName+ '?viewPerPage=' + num;
	 window.location.href = url;
	
}

function changeCityCatalog(str,type){
	
	var paremeter;
	var hostname = "http://"+document.domain+"/";
	if(document.domain == "localhost"){
		hostname = location.href;
	}
	if(type == 'City'){
		paremeter = 'selectCity_' + str;
	}else if(type == 'Catalog'){
		paremeter = 'selectSort_' + str;
	}
	
	$.ajax({
		type : "GET",
		url : hostname + paremeter,
		beforeSend : function(){
			$('#overlay').fadeIn();
			$('#box').fadeIn();
		},
		success : function(){
			window.location.reload();
		}
	})
	
}

function Prepare(){
//		var order = document.getElementById("Order");
//	for(i = 0;i<=order.length;i++){
//		
//		if(order.options[i].value == 'order_publishTime'){
//			order.options[i].selected = true;
//			return;
//		}
//		
//	}	

}

//ֲ
function Overlay(){
 	var height=$('body').height();
    var top = (windowHeight()-70)/2;
    var left = (windowWidth()-310)/2
    $('body').append('<div id="overlay" style="display:none;_width:'+windowWidth()+';height:'+height+'px"></div>');
 
    $('#overlay').css('opacity',0.7); 	
	$('#FeedBackTable').css({'top': top+'px' , 'left':left+'px'});
	//$('body').append('<div id="box" style="display:none;top:'+top+'px;left:'+left+'px"><p><img src="/images/loading.gif"  />loading</p></div>');
}

function windowHeight() {
    var de = document.documentElement;
    return self.innerHeight ||
        ( de && de.clientHeight ) ||
        document.body.clientHeight;
}

function windowWidth() {
    var de = document.documentElement;
    return self.innerWidth ||
        ( de && de.clientWidth ) ||
        document.body.clientWidth;
}



