<!--
function clickIE4(){
	if (event.button==2){
		return false;
	}
}
function clickNS4(e){
	if (document.layers||document.getElementById&&!document.all){
		if (e.which==2||e.which==3){
			return false;
		}
	}
}
if (document.layers){
	document.captureEvents(Event.MOUSEDOWN);
	document.onmousedown=clickNS4;
}
else if (document.all&&!document.getElementById){
	document.onmousedown=clickIE4;
}
document.oncontextmenu=new Function("return false")
// -->
function validateSearch(){
	var root=document.search;
	var phrase=root.phrase;
	if(phrase.value=="" || phrase.value=="search"){
		alert('please enter a keyword greater than 3 characters !');
		phrase.focus();
		return false;
	}
}
function posTagDiv(x,y,tag){
	x = parseInt(x);
	y = parseInt(y);
	//	img_x = $('image_display').offsetTop;
	//	img_y = $('image_display').offsetLeft;
	//	x = parseInt(img_x + x - 113);
	//	y = parseInt(img_y + y + 70);
	$('tag_square').style.display='block';
	$('tag_square').style.top=y-20+'px';
	$('tag_square').style.left=x+10+'px';
}
function removeTagDiv(){
	$('tag_square').style.display='none';
	$('tag_square').style.top='0px';
	$('tag_square').style.left='0px';
}
var Timer;
function ScrollLeft(){
	Timer = setInterval("document.getElementById('PANORAMA').scrollLeft -= 3", 15);
}
function ScrollRight(){
	Timer = setInterval("document.getElementById('PANORAMA').scrollLeft += 3", 15);
}
function getDisplayImage(id){
	if($('image_display')){
		$('image_display').hide();
	}
	$('waiting').style.display="block";
	new Ajax.Request('/galleries/getphoto_ajax/'+id, {
		method: 'POST',
		parameters: {photo:id},
		onSuccess: function(response){
			$('waiting').style.display="none";
			$('container_image_tags').innerHTML=response.responseText;
			$('image_display').appear({ duration: 0.5});
		},
		onFailure: function(response) {
			window.alert('An error occured please try again');
		}
	});
	return false;
}
function initScrollLayerv() {
	var wndo = new dw_scrollObj('wnv', 'lyr1v', 't1v');
	wndo.setUpScrollbar("dragBarv", "trackv", "v", 1, 1);
}
function sendMessageToAdmin(){
	$('message_text').innerHTML="Sending your message ...";
	$('message_holder').appear();
	subject = document.getElementById('subject').value;
	message = document.getElementById('message').value;
	if(subject == ''){
		$('message_text').innerHTML="Please fill in the subject field";
		$('message_holder').appear();
		return false;
	}
	if(message == ''){
		$('message_text').innerHTML="Please fill in your message";
		$('message_holder').appear();
		return false;
	}
	to = -1;
	new Ajax.Request('/messages/send/'+subject+'/'+message, {
		method: 'POST',
		parameters: {to: to,subj: subject,msg: message},
		onSuccess: function(response) {
			$('subject').value='';
			$('message').value='';
			$('message_text').innerHTML=response.responseText;
			$('message_holder').appear();
			new Effect.Fade('message_holder',{duration:0.5,delay:8});
			$('messages').value='';
		},
		onFailure: function(response) {
			window.alert('An error occured please try again');
		}
	});
}
function deleteMessage(message_id,memberId,thread_id){
	new Ajax.Request('/messages/delete_message/'+memberId+'/'+message_id+'/'+thread_id, {
		method: 'POST',
		parameters: {member_id: memberId,message: message_id,t_id :thread_id},
		onSuccess: function(response) {
			$('message_container').innerHTML=response.responseText;
			$('message_holder').appear();
			new Effect.Fade('message_holder',{duration:0.5,delay:8});
			$('messages').value='';
		},
		onFailure: function(response) {
			window.alert(response.responseText);
		}
	});
	return false;
}
function markAsRead(id,reply_status,to_member){
	new Ajax.Request('/messages/markAsRead/'+id+'/1/'+to_member, {
		method: 'POST',
		parameters: {messageID: id,member: to_member},
		onSuccess: function(response) {
			if(reply_status == 0){
				document.getElementById('image_control_'+id).innerHTML="<a href='#' onclick='markAsUnRead("+id+","+reply_status+","+to_member+");return false;\'><img src='/img/spacer.gif' alt='' height='11' width='11' border='0' onmouseover='this.src=\"/img/new_message_user.gif\"' onmouseout='this.src=\"/img/spacer.gif\"' title='Mark as unread' /></a>";
			}else{
				document.getElementById('image_control_'+id).innerHTML="<a href='#' onclick='markAsUnRead("+id+","+reply_status+","+to_member+");return false;'><img src='/img/reply.gif' alt='' height='11' width='11' border='0' onmouseover='this.src=\"/img/new_message_user.gif\"' onmouseout='this.src=\"/img/reply.gif\"' title='Mark as unread' /></a>";
			}
		},
		onFailure: function(response) {
			window.alert('An error occured please try again');
		}
	});
}
function markAsReadThread(thread_id,memberId){
	new Ajax.Request('/messages/markAsReadThread/'+thread_id+'/'+memberId, {
		method: 'POST',
		parameters: {t_id:thread_id,member:memberId},
		onSuccess: function(response) {
			if(reply_status == 0){
				document.getElementById('image_control_'+id).innerHTML="<a href='#' onclick='markAsUnRead("+id+","+reply_status+","+to_member+");return false;\'><img src='/img/spacer.gif' alt='' height='11' width='11' border='0' onmouseover='this.src=\"/img/new_message_user.gif\"' onmouseout='this.src=\"/img/spacer.gif\"' title='Mark as unread' /></a>";
			}else{
				document.getElementById('image_control_'+id).innerHTML="<a href='#' onclick='markAsUnRead("+id+","+reply_status+","+to_member+");return false;'><img src='/img/reply.gif' alt='' height='11' width='11' border='0' onmouseover='this.src=\"/img/new_message_user.gif\"' onmouseout='this.src=\"/img/reply.gif\"' title='Mark as unread' /></a>";
			}
		},
		onFailure: function(response) {
			window.alert('An error occured please try again');
		}
	});
}
function markAsUnRead(id,reply_status,to_member){
	new Ajax.Request('/messages/markAsUnRead/'+id+'/0/'+to_member, {
		method: 'POST',
		parameters: {},
		onSuccess: function(response) {
			if(reply_status == 0){
				document.getElementById('image_control_'+id).innerHTML="<a href='#' onclick='markAsRead("+id+","+reply_status+","+to_member+");return false;'><img src='/img/new_message_user.gif' alt='' height='11' width='11' border='0' onmouseover=this.src='/img/spacer.gif' onmouseout=this.src='/img/new_message_user.gif' title='Mark as read' /></a>";
			}else{
				document.getElementById('image_control_'+id).innerHTML="<a href='#' onclick='markAsRead("+id+","+reply_status+","+to_member+");return false;'><img src='/img/new_message_user.gif' alt='' height='11' width='11' border='0' onmouseover=this.src='/img/reply.gif' onmouseout=this.src='/img/new_message_user.gif' title='Mark as unread' /></a>";
			}
		},
		onFailure: function(response) {
			window.alert('An error occured please try again');
		}
	});
}
function checkUncheckAll(status) {
	var elements = document.getElementsByClassName('checkBoxClass');
	for (i=0;i<elements.length;i++)
	{
		if(status==1){
			elements[i].checked=true;
		}else{
			elements[i].checked=false;
		}
	}
}
function replyMessage(id,member_id){
	var message = document.getElementById("messages").value;
	var subj = document.getElementById("subject").value;
	new Ajax.Request('/messages/reply/', {
		method: 'post',
		parameters: {messageID:id,MessageText:message,memberId:member_id,subject:subj},
		onSuccess: function(response) {
			
			$('message_container').innerHTML=response.responseText;
			$('message_holder_r').style.display='block';
			$('message_holder_r').appear();
			new Effect.Fade('message_text_r',{duration:0.5,delay:8});
			$('messages').value='';
		},
		onFailure: function(response) {
			window.alert('An error occured please try again');
		}
	});
	return false;
}
function checkUncheckAll(status) {
	var elements = document.getElementsByClassName('checkBoxClass');
	for (i=0;i<elements.length;i++)
	{
		if(status==1){
			elements[i].checked=true;
		}else{
			elements[i].checked=false;
		}
	}
}
///////////////////////messages\\\\\\\\\\\\\\\\\\\\\\\\

function getAboutData(id){
	$('loader_main_container').style.display='block';
	$('container_about').fade({ duration: 1.0, from: 0, to: 1 });
	new Ajax.Request('/sections/about_ajax/'+id, {
		method: 'post',
		parameters: {},
		onSuccess: function(response) {
			$('loader_main_container').style.display='none';
			$('container_about').innerHTML=response.responseText;
			Effect.Appear('container_about',{duration:1.0});
			//Effect.SlideDown('container_about',{duration:2});
			initScrollLayerv();
		},
		onFailure: function(response) {
			window.alert('An error occured please try again');
		}
	});
	return false;
}
function getAboutDataBranch(id,branch_id){
	$('loader_main_container').style.display='block';
	$('container_about').fade({ duration: 1.0, from: 0, to: 1 });
	new Ajax.Request('/sections/about_ajax/'+id+'/'+branch_id, {
		method: 'post',
		parameters: {},
		onSuccess: function(response) {
			$('loader_main_container').style.display='none';
			$('container_about').innerHTML=response.responseText;
			Effect.Appear('container_about',{duration:1.0});
			//Effect.SlideDown('container_about',{duration:2});
			initScrollLayerv();
		},
		onFailure: function(response) {
			window.alert('An error occured please try again');
		}
	});
	return false;
}
GetCalendar = function(URL){
	$('waiting').style.display='block';
	new Ajax.Request(URL, {
		method: 'POST',
		onSuccess: function(transport) {
			$('waiting').style.display='none';
			var response = transport.responseText;
			if(response != '')
			{
				$('CalendarBlock').innerHTML = response;
				return false;
			}
			if(response == '')
			{
				$('CalendarBlock').innerHTML = '<div class="error_message" style="width:425px;">An error occured while sending message. Please try again.</div>';
				return fasle;
			}
		},
		onCreate: function() {
		},
		onFailure: function() {
			$('CalendarBlock').innerHTML = '<div class="error_message" style="width:425px;">An error occured while sending message. Please try again.</div>';
		}
	});
	return false;
}
function initScrollLayerv() {
	//alert("entered");
	var wndo = new dw_scrollObj('wnv', 'lyr1v', 't1v');
	wndo.setUpScrollbar("dragBarv", "trackv", "v", 1, 1);
}
function initScrollLayer() {
	//alert("entered");
	var wndo = new dw_scrollObj('wn', 'lyr1', 't1');
	wndo.setUpScrollbar("dragBar", "track", "v", 1, 1);
}
function showAddNewNetwork(){
	document.getElementById('layerDiv').style.visibility='visible';
	document.getElementById('new_network').style.visibility='visible';
	document.getElementById('calendarDiv').style.display='block';
}

function closeNetwork(){
	document.getElementById('layerDiv').style.visibility='hidden';
	document.getElementById('new_network').style.visibility='hidden';
	document.getElementById('calendarDiv').style.display='none';
}

function openForm(id){
	document.getElementById('layerDiv').style.visibility='visible';
	document.getElementById('alertMe').style.visibility='visible';
	document.getElementById('event_id').value=id;
}

function closeForm(id){
	document.getElementById('layerDiv').style.visibility='hidden';
	document.getElementById('alertMe').style.visibility='hidden';
	document.getElementById('event_id').value='';
}
function checkContactform(){
	var root=document.myform;
	var name=root.full_name;
	var email=root.email;
	var subject=root.subject;
	var message=root.message;

	if(name.value==""){
		alert('Please enter your full name.');
		name.focus();
		return false;
	}
	if(email.value==""){
		alert('Please enter an email address.');
		email.focus();
		return false;
	}
	var pattern = /^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/;
	flag=email.value.match(pattern);
	if(!flag){
		alert('Please insert a valid email address.');
		email.select();
		return false;
	}
	if(subject.value==""){
		alert('Please enter the subject.');
		subject.focus();
		return false;
	}
	if(message.value==""){
		alert('Please enter your message.');
		message.focus();
		return false;
	}
}

function clearContactForm(){
	var root=document.myform;
	var name=root.full_name;
	var email=root.email;
	var subject=root.subject;
	var message=root.message;
	if(confirm('Are you sure you want to clear this form?')){
		name.value="";
		email.value="";
		subject.value="";
		message.value="";
		return false;
	}
	return false;
}
var sign_clicked=0;
function open_details(){
	if(sign_clicked==0){

		$('sign_in_div').grow();
		sign_clicked=1;
	}else{
		$('sign_in_div').puff();
		sign_clicked=0;
	}
	return false;
}
function displayAlertMe(id){
	$('alertMe').grow();
	$('event_id').value=id;
}
function closeAlertMe(id){
	$('alertMe').fade();
	$('event_id').value=id;
}
function getNewsInCat(id,branch){
	new Ajax.Request('/news/news_ajax/'+id+'/'+branch, {
		method: 'post',
		parameters: {},
		onSuccess: function(response) {
			$('NewsBlock').innerHTML=response.responseText;
		},
		onFailure: function(response) {
			window.alert('An error occured please try again');
		}
	});
	return false;
}
function BlindUpDown(obj_id){
	Effect.toggle(obj_id,'slide');
}
