function fullImgWin(id,width,height) {
  popUpWin = open('/gallery/fullimg/'+id+'/', 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+'');

}


//Comment Functions
function addComment() {
	var div = document.getElementById("add_comment");
	if(div.style.display=="block") {
		div.style.display="none";
	} else {
		div.style.display="block";
	};
}

function saveComment(id) {
	commentError("CLR");
	var cmtname = document.forms[0].cmt_name.value;
	var cmttxt = document.forms[0].comment.value;
	if(cmtname!="" && cmttxt !="") {
			document.forms[0].saveCommentbtn.value="Saving..."
			document.forms[0].saveCommentbtn.disabled=true;
			var xmlhttp;
				if (window.XMLHttpRequest){
						 var xmlhttp = new XMLHttpRequest()
				} else {
					if (window.ActiveXObject){
						var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
					}
				}
					xmlhttp.open('GET', '/remgallery/comment.php?pid='+id+'&name='+cmtname+'&msg='+cmttxt, true);
					xmlhttp.onreadystatechange = function() {
						if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
							document.getElementById("view_comment").innerHTML=xmlhttp.responseText;
							addComment();
						} else {
						};
					};
			xmlhttp.send(null);

	} else {
		commentError("Please fill out all the boxes!");
	}
}

function commentError(text) {
	var div = document.getElementById("comment_error");
	if(text=="CLR") {
		div.style.display="none";
		div.innerHTML="";
	} else {
		div.innerHTML=text;
		div.style.display="block";
	}; 
}

function imgRate(vote,id) {
	var xmlhttp;
	if (window.XMLHttpRequest){
			 var xmlhttp = new XMLHttpRequest()
	} else {
		if (window.ActiveXObject){
			var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 
		}
	}
		xmlhttp.open('GET', '/remgallery/ratepic.php?pid='+id+'&rate='+vote, true);
		xmlhttp.onreadystatechange = function() {
			if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
				document.getElementById('final-rate-bar').style.width=xmlhttp.responseText+"%";
			} else {
			};
		};
xmlhttp.send(null);
}

