function sendFrmRequest(url,frm,div,message)
{
	if(message!='')
	{
		
		if(window.confirm(message))
		{
			//sendFromRequest(url,param,frm,div);
		$.post(url,$('#'+frm).serialize(),function(data){
				if(data.length >0)
				{
                
					$('#'+div).html(data);
				}
			});
		}else
		{
			return false;
		}
	}
	else
	{
		//sendFromRequest(url,param,frm,div);
		$.post(url,$('#'+frm).serialize(),function(data){
				if(data.length >0)
				{
                
					$('#'+div).html(data);
				}
			});
	}  
}

function sendRequest(url,div,message)
{
	
	
	
	
		getPage(url,div);
	
  
}



function muContent(id,cid)
{
		var div="muContent";
		url="index.php?id="+id+"&cid="+cid+"";
		
		 $.post(url, function(data){
				
				if(data.length >0)
				{
                
					$('#'+div).html(data);
				}
		});	 
}


function getPage(url,div) {
	
	//generate the parameter for the php script

	$.ajax({
		url: url,	
		type: "POST",				
		cache: false,
		success: function (html) {	
		
			//hide the progress bar
			$('#loading').hide();	
			$('#'+div).show();
			//add the content retrieved from ajax and put it in the #content div
			$('#'+div).html(html);
			
			
			//display the body with fadeIn transition
			$('#'+div).fadeIn('slow');	
			
			init();	
		}		
	});
}


function popUP(link,name,width,height)
{
	window.open(link,name,"width="+width+",height="+height+",toolbar=no, location=no,directories=no,status=no,menubar=no,scrollbars=no,copyhistory=no, resizable=no");	
}
function popUPTwo(link,name,width,height)
{
	window.open(link,name,"width="+width+",height="+height+",toolbar=no, location=no,directories=no,status=no,menubar=yes,scrollbars=no,copyhistory=no, resizable=no");	
}

function displayQCalendar(path,div,m,y)
{
	var ran_no=(Math.round((Math.random()*9999))); 
	var url=path+'&m='+m+'&y='+y+'&ran='+ran_no;
			
	sendSingleRequest(url,div);
}


$(document).ready(function() {
    	/*
      	$('#utilitybar #q')
        .bind("click", function() {
          if (this.value == "Search Queen's...") { this.value=""; }
        });
    	*/
        
        
        $('#events').newsticker(5000);	
     
       
    	 $('#gallery a').lightBox(); 
        
    	
	

		init();
        
        
    });
    
  
    function init()
    {
    	$('li[rel=navMain]').click(function () {
		
		//clear the selected class and add the class class to the selected link
	 	$('li[rel=navMain]').removeClass('selected');
	 	$(this).addClass('selected');
	 	
		});
    	
    	$('li[rel=navSub]').click(function () {
		
		//clear the selected class and add the class class to the selected link
	 	$('li[rel=navSub]').removeClass('selected');
	 	$(this).addClass('selected');
	 	
		});
		
		$('li[rel=link]').click(function () {
		
		//clear the selected class and add the class class to the selected link
	 	$('li[rel=link]').removeClass('selected');
	 	$(this).addClass('selected');
	 	
		});
    }


