// JavaScript Document
$(document).ready(function(){	
	create_menu();
	
	$(".profile-menu").mouseover(function(){ 
		$(this).css('cursor', 'pointer');		
	});
		
	function create_menu()
	{
		var h;
		$('.profile-menu').each(function(){
			pid = $(this).attr('id');
			h ='';
			h += '<div class="children hide" parent="'+pid+'">';
			
			if($('li[parent="'+pid+'"]').length < 1){return;}
			
			$('li[parent="'+pid+'"]').each(function(){
				if($(this).attr('rel') == '1'){
					h += '<a href="http://'+$(this).attr('page')+'" target="blank">';
				}
				else
				{
					h += '<a href="'+$(this).attr('page')+'">';
				}
				h += '<li>'+$(this).text()+'</li>';
				h += '</a>';			
			});
			
			h += '</div>';
			
			$(this).append(h);
			$(this).attr('isparent', 1);
		});	
		
		$('li[id="about"]').find('div').addClass('opend').show();
	}
	
	var curr;
	
	$('.profile-menu').click(function(){
	
		if($(this).attr('isparent') == null){window.location = $(this).attr('page')}
		
		$('div.opend').removeClass('opend').slideUp(500);
		if($(this).attr('id') == curr){curr =''; return;}
		
		$(this).find('div').addClass('opend');		
		$(this).find('div').slideDown(300);
		curr = $(this).attr('id');
	});
	
	$('.feedback').click(function(){
		newwindow=window.open('feedback.php','name','height=326,width=750');
		if (window.focus) {newwindow.focus()}
		return false;
	});
	
	$('.blog').click(function(){
		newwindow=window.open('blog_login.php','name','height=326,width=750');
		if (window.focus) {newwindow.focus()}
		return false;
	})
	
function popitup2(url) {
	newwindow=window.open(url,'name','height=164,width=280');
	if (window.focus) {newwindow.focus()}
	return false;
}

	$("#slider").easySlider({
		auto: true,
		continuous: true,
		numeric: true
	});
	
	$('.titler').html($("#slider").find('img').eq(1).attr('caption'));
});
