﻿function showFullDesc() {
	fetch_object('short_description').style.display = 'none';
	fetch_object('full_description').style.display ='';	
}

function showShortDesc() {
	fetch_object('short_description').style.display = '';
	fetch_object('full_description').style.display = 'none';	
}

function savePostReview(rid) {
	var votes = fetch_object('votes_rv').value;
	var request ='&title='+encodeURIComponent(fetch_object('title_rv').value)+'&cons='+encodeURIComponent(fetch_object('cons_rv').value)+'&pros='+encodeURIComponent(fetch_object('pros_rv').value)+'&overall='+encodeURIComponent(fetch_object('overall_rv').value)+'&id='+rid+'&votes='+votes;	
	var aurl ='index.php?m=showitem/ajax&do=save_post';	
	var xmlHttp4 = createxmlHttp();
		if ((xmlHttp4.readyState == 4) || (xmlHttp4.readyState == 0 )) {
			xmlHttp4.open("POST", aurl, true);
			xmlHttp4.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
			xmlHttp4.setRequestHeader("Content-length", request.length);
			xmlHttp4.setRequestHeader("Connection", "close");
			xmlHttp4.onreadystatechange = function() {
				if ((xmlHttp4.readyState == 1) || (xmlHttp4.readyState == 2)) {
					
				} else if ((xmlHttp4.readyState == 4) && (xmlHttp4.status == 200)) {
						var response = xmlHttp4.responseText;
						alert(response);
					}
				}
			xmlHttp4.send(request);
		} else setTimeout('savePostReview(rid)',10000);	
	return false;
}

function showPicture(a,total) {
	$("#pictureDetail_"+a).css("display","");
	for (var i = 1; i <= total; i ++) {
		if (i == a) {
			$("#textshow_"+a).css('display','');
			$('#picID_'+a).css({"color":"#ff9900"});
		}	
		else {
			$("#pictureDetail_"+i).css("display","none");
			$("#textshow_"+i).css('display','none');
			$('#picID_'+i).css({"color":"#000"});
		}	
	}
	$("#picCurr").val(a);
}

function showPicScroll(ptype,total) {
	var cur = parseInt($("#picCurr").val());
	
	var pg = 0;
	
	if (cur == 1 && ptype == 0) {
		pg = total;
	} else if (cur == total && ptype == 1) {
		pg = 1;
	} else {	
		pg = (ptype == 0) ? cur - 1 : cur + 1;
	}
	
	showPicture(pg,total);
	
}	
