$(document).ready(function() {
	$('div.photo_expand a').fancyZoom({scaleImg: true, closeOnClick: true});
});

function addLoadEvent(func) {
	var oldonload = window.onload;
	if( typeof window.onload != 'function' ) {
		window.onload = func;
	} 
	else {
		window.onload = function() {
			if(oldonload) {
				oldonload();
			}
			func();
		}
	}
}

function getRandomNumber() {
	var randomnumber=Math.floor(Math.random()*999999);
	return randomnumber;
}

function showComments() {
	document.getElementById('commnets_brief').style.display='none';
	document.getElementById('comments_list').style.display='block';
	document.getElementById('comment_post').style.display='block';
}

// Check data
function checkData() {
  String.prototype.Trim = function(){return this.replace(/(^\s*)|(\s*$)/g,"");}
  String.prototype.Ltrim = function(){return this.replace(/(^\s*)/g, "");}
  String.prototype.Rtrim = function(){return this.replace(/(\s*$)/g, "");}

  var copaForm = document.forms[1];

  if( copaForm.dec_ComAuthor.value.Trim() == "" ) { 
	copaForm.dec_ComAuthor.value = "";
	document.getElementById('alert_dec_ComAuthor').style.display='block';
	copaForm.dec_ComAuthor.focus();
	return false;
  }
  else {
	document.getElementById('alert_dec_ComAuthor').style.display='none';
  }

  if( copaForm.dec_ComCopy.value.Trim() == "" ) { 
	copaForm.dec_ComCopy.value = "";
	document.getElementById('alert_dec_ComCopy').style.display='block';
	copaForm.dec_ComCopy.focus();
	return false;
  }
  else {
	document.getElementById('alert_dec_ComCopy').style.display='none';
  }

  if( copaForm.authinput.value.Trim() == "" ) { 
	copaForm.authinput.value = "";
	document.getElementById('alert_authinput').style.display='block';
	copaForm.authinput.focus();
	return false;
  }
  else {
	document.getElementById('alert_authinput').style.display='none';
  }
}
