var cur_img_seq;
function setimgsrc(img_seq,img_url,is_vip) {
	var arrySize = getPageSize();
	var max_height;
	cur_img_seq= img_seq;
	var cur_scale= Imgscale[img_seq];
	var cur_width= cur_scale.substr(0,cur_scale.indexOf('*'));
	var cur_height = cur_scale.substr(cur_scale.indexOf('*')+1,cur_scale.length);
	
	//document.getElementById("imgtitle").innerHTML=Imgtitle[img_seq];
	if(Imgdesc[img_seq]!='')
		document.getElementById("imgdesc").innerHTML=Imgdesc[img_seq];
	else
		document.getElementById("imgdesc").innerHTML=Imgtitle[img_seq];
	document.getElementById("BigImageObj").src=img_url+"_"+img_seq+".jpg";
	
	document.getElementById("tip").innerHTML="此图片由网友 " + Imgowner[img_seq] +" 于 " +Imgdate[img_seq]+ " 上传<br>原图大小： " +Imgscale[img_seq];
	if(is_vip==1) 
		document.getElementById("btnview").href= img_url.replace('ProjectPic','ProjectPicSource')+"_"+img_seq+".jpg";
}

function getimg(direct,str_img_url,is_vip) {
	var tmp_seq;
	if(direct==-1) {
		tmp_seq= cur_img_seq-1;
		if(tmp_seq>0) 
			setimgsrc(tmp_seq,str_img_url,is_vip) ;
		else
			alert('已经是第一张图了！');
	} else {
		tmp_seq= cur_img_seq+1;
		if(tmp_seq<=img_total_num) 
			setimgsrc(tmp_seq,str_img_url,is_vip) ;
		else
			alert('已经是最后一张图了！');
	}
}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}

	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}