<!--

/////////////////////////////////////////////////////////////////////////////

//	JQUERY

/////////////////////////////////////////////////////////////////////////////



$(document).ready(function(){
	
	

	
	//show/hide submenus
	
	$(".show_drop").hide();
	
	$('.hide_ref li ul li').click(function(event) {
		$(this).children(":hidden").show(function(){
			});
		$(".show_drop:visible").hide();
	});
	
	
	//round corners
	
					curvySettings = {
					tl: { radius: 12 },
					tr: { radius: 12 },
					bl: { radius: 12 },
					br: { radius: 12 },
					antiAlias: true
		      }
	

	curvyCorners(curvySettings,".contact_head, #horizboxg, #sbb_, #sbl_, .tb_ul, .containerpro, .pro_box, .pro_para, #homepage_menu, #main_menu, #livebox, .contact_form, .form_fs");	
	
	
	//rotator
	
	so_init();
	
	//php to js variables
	
	searchVars = new Array();
	searchVars['pgb'] = new Array();
	searchVars['sbb'] = new Array();
	searchVars['pgl'] = new Array();
	searchVars['sbl'] = new Array();
	searchVars['sbb_p'] = new Array();
	searchVars['sbb_p']['zn'] = 'all';
	searchVars['sbb_p']['sv'] = '';
	searchVars['sbb_p']['va'] = '';
	searchVars['sbb_p']['ag'] = 0;
	searchVars['sbb_p']['sx'] = 0;
	searchVars['sbb_p']['ct'] = '';
	searchVars['sbb_p']['fba'] = '';
	searchVars['sbb_p']['since'] = 0;
	searchVars['sbl_p'] = new Array();
	searchVars['sbl_p']['zn'] = 'all';
	searchVars['sbl_p']['sv'] = '';
	searchVars['sbl_p']['va'] = '';
	searchVars['sbl_p']['ag'] = 0;
	searchVars['sbl_p']['sx'] = 0;
	searchVars['sbl_p']['ct'] = '';
	searchVars['sbl_p']['fba'] = '';
	searchVars['sbl_p']['since'] = 0;
	
	
	smileys = new Array();

	if(typeof php2js == 'function') {
	
	php2js('l');
	php2js('b');
	getSmileys();	
	}
	
//reload video links in sbb
	

	setTimeout(function(){paginBox('b', 2);}, 500);
	
	function greyBox (box, id) {
		
		$("#add_comment_div").remove();

		if(id != 'close' && $("#sb" + box + "_grey").length == 0 && $("#sb" + box + " .pop_box").length == 0) {
	
			$("#sb" + box + "_liner").append('<div id="sb' + box + '_grey"></div><div class="pop_box" id="' + id + '"><p class="sb_close"><a href="#">close</a></p><div class="sb_cont"></div></div>');
			curvyCorners(curvySettings,"#sb" + box + "_grey, .pop_box");
			$("#sb" + box + "_grey").hide();
			$("#sb" + box + " .pop_box").hide();		
			$("#sb" + box + "_grey").fadeTo('slow', 0.8);
			$("#sb" + box + " .pop_box").fadeTo('slow', 0.99);
			$("#twtr-widget").fadeTo('slow', 0.1);
			if(box == 'b') {
				$("#sbb").css("border", "3px solid #FFFFFF");
			}
			
		} else {
			sbVars(box);
			$("#sb" + box + " .pop_box").empty();				
			$("#sb" + box + "_grey, #sb" + box + " .pop_box").fadeOut('slow', function() {
			$("#sb" + box + "_grey, #sb" + box + " .pop_box").detach();
			$("#twtr-widget").fadeTo('slow', 0.99);
			if(box == 'b') {
				$("#sbb").css("border", "3px solid #999999");
			}
				
				});
			
		}

	}
	
	
	
	function sbVars(box) {
	//alert($("#sb" + box + "_zn option:selected").val());

		//get variables from form inputs
		
		searchVars['sb' + box]['va'] = ($("#sb" + box + "_va").val()) ? escape($("#sb" + box + "_va").val()).replace('+', '%2B') : '';
		searchVars['sb' + box]['zn'] = ($("#sb" + box + "_zn").val()) ? escape($("#sb" + box + "_zn").val()).replace('+', '%2B') : '';
		searchVars['sb' + box]['sv'] = ($("#sb" + box + "_sv").val()) ? escape($("#sb" + box + "_sv").val()).replace('+', '%2B') : '';
		searchVars['sb' + box]['pn'] = ($("#sb" + box + "_pagename").val()) ? escape($("#sb" + box + "_pagename").val()).replace('+', '%2B') : '';
		switch (searchVars['sb' + box]['tb']) {
			case 'comments' :
				searchVars['sb' + box]['va'] = ($("#sb" + box + "_va").val()) ? escape($("#sb" + box + "_va").val()).replace('+', '%2B') : '';
				searchVars['sb' + box]['zn'] = ($("#sb" + box + "_zn").val()) ? escape($("#sb" + box + "_zn").val()).replace('+', '%2B') : '';
				searchVars['sb' + box]['sv'] = ($("#sb" + box + "_sv").val()) ? escape($("#sb" + box + "_sv").val()).replace('+', '%2B') : '';				
				break;
			case 'videos': 
				searchVars['sb' + box]['va'] = ($("#sb" + box + "_va").val()) ? escape($("#sb" + box + "_va").val()).replace('+', '%2B') : '';
				searchVars['sb' + box]['zn'] = ($("#sb" + box + "_zn").val()) ? escape($("#sb" + box + "_zn").val()).replace('+', '%2B') : '';
				searchVars['sb' + box]['sv'] = ($("#sb" + box + "_sv").val()) ? escape($("#sb" + box + "_sv").val()).replace('+', '%2B') : '';
				break;
			case 'market': 
				searchVars['sb' + box +'_p']['fba'] = ($("#sb" + box + "_fba").val()) ? escape($("#sb" + box + "_fba").val()).replace('+', '%2B') : '';
				searchVars['sb' + box +'_p']['since'] = ($("#sb" + box + "_since").val()) ? escape($("#sb" + box + "_since").val()).replace('+', '%2B') : '';
				searchVars['sb' + box +'_p']['sv'] = ($("#sb" + box + "_sv").val()) ? escape($("#sb" + box + "_sv").val()).replace('+', '%2B') : '';
				searchVars['sb' + box +'_p']['ct'] = ($("#sb" + box + "_ct").val()) ? escape($("#sb" + box + "_ct").val()).replace('+', '%2B') : '';
				break;
			case 'DJs': 
				searchVars['sb' + box +'_p']['va'] = ($("#sb" + box + "_va").val()) ? escape($("#sb" + box + "_va").val()).replace('+', '%2B') : '';
				searchVars['sb' + box +'_p']['zn'] = ($("#sb" + box + "_zn").val()) ? escape($("#sb" + box + "_zn").val()).replace('+', '%2B') : '';
				searchVars['sb' + box +'_p']['sv'] = ($("#sb" + box + "_sv").val()) ? escape($("#sb" + box + "_sv").val()).replace('+', '%2B') : '';
				searchVars['sb' + box +'_p']['ag'] = ($("#sb" + box + "_ag").val()) ? escape($("#sb" + box + "_ag").val()).replace('+', '%2B') : '';
				searchVars['sb' + box +'_p']['sx'] = ($("#sb" + box + "_sx").val()) ? escape($("#sb" + box + "_sx").val()).replace('+', '%2B') : '';
				searchVars['sb' + box +'_p']['ct'] = ($("#sb" + box + "_ct").val()) ? escape($("#sb" + box + "_ct").val()).replace('+', '%2B') : '';
				break;
			case 'merchandise': var limit = 10;
				break;
			default: var limit = 5;
			
		}
		switch (searchVars['sbl']['tb']) {
			case 'comments' : var limit = 5;

				break;
			case 'videos': var limit = 4;
				break;
			case 'DJs': var limit = 4;
				break;
			default: var limit = 5;
			
		}
		
		
		searchVars['sb' + box]['limit'] = ($("#sb" + box + "_limit").val()) ? parseInt($("#sb" + box + "_limit").val()) : limit;
		searchVars['sb' + box]['ca'] = ($("#sb" + box + "_ca").val()) ? escape($("#sb" + box + "_ca").val()).replace('+', '%2B') : '';
		searchVars['sb' + box]['av'] = ($("#sb" + box + "_av").val()) ? parseInt($("#sb" + box + "_av").val()) : 0;
		
	}

	function paginBox(box, num) {

		$("#sb" + box + " .sb_spinner").show("slow");

		switch(num)
			{
			case 0:
				searchVars['sb'+box]['page'] = $("#sb" + box + " .ibpl_last").val();
			  break;
			case 1:
				searchVars['sb'+box]['page'] ++ ;
			  break;
			case 2:
			  break;
			case 3:
				searchVars['sb'+box]['page'] = searchVars['sb'+box]['page'] - 1 ;
			  break;
			case 4:
				searchVars['sb'+box]['page'] = 0;
			  break;
			}
			
			
		if (searchVars['sb' + box]['tb'] == 'DJs') {

			queryString = "page" + box + "=" + searchVars['sb' + box]['page'] + "&tb" + box + "=" + searchVars['sb' + box]['tb'] + "&limit=" + searchVars['sb' + box]['limit'] + "&sv" + box + "=" + searchVars['sb' + box + '_p']['sv'] + "&zn" + box + "=" + searchVars['sb' + box + '_p']['zn'] + "&va" + box + "=" + searchVars['sb' + box + '_p']['va'] + "&ag" + box + "=" + searchVars['sb' + box + '_p']['ag'] + "&sx" + box + "=" + searchVars['sb' + box + '_p']['sx'] + "&ct" + box + "=" + searchVars['sb' + box + '_p']['ct'];		

		} else {
		
			if (searchVars['sb' + box]['tb'] == 'merchandise') {

				queryString = "page" + box + "=" + searchVars['sb' + box]['page'] + "&tb" + box + "=merchandise&limit=" + searchVars['sb' + box]['limit'] + "&sv" + box + "=" + searchVars['sb' + box + '_p']['sv'] + "&ds" + box + "=" + searchVars['sb' + box]['ds'];
			
			} else {
				
				if (searchVars['sb' + box]['tb'] == 'courses') {
			
						queryString = "pagename=" + searchVars['sb' + box]['pn'] + "&self=" + searchVars['pgb']['self'] + "&page" + box + "=" + searchVars['sb' + box]['page'] + "&tb" + box + "=" + searchVars['sb' + box]['tb'] + "&zn" + box + "=" + searchVars['sb' + box]['zn'] + "&nm=" + searchVars['pgb']['nm'] + "&co" + box + "=" + searchVars['sb' + box]['co'];		

				} else {
					if (searchVars['sb' + box]['tb'] == 'market') {
			
							queryString = "pagename=" + searchVars['sb' + box]['pn'] + "&self=" + searchVars['pgb']['self'] + "&page" + box + "=" + searchVars['sb' + box]['page'] + "&tb" + box + "=" + searchVars['sb' + box]['tb'] + "&since" + box + "=" + searchVars['sb' + box + '_p']['since'] + "&fba" + box + "=" + searchVars['sb' + box + '_p']['fba'] + "&sv" + box + "=" + searchVars['sb' + box + '_p']['sv'] + "&ct" + box + "=" + searchVars['sb' + box + '_p']['ct'];		

					} else {
					
						if(searchVars['sb' + box]['co']) {
							
							queryString = "pagename=" + searchVars['sb' + box]['pn'] + "&self=" + searchVars['pgb']['self'] + "&page" + box + "=" + searchVars['sb' + box]['page'] + "&tb" + box + "=" + searchVars['sb' + box]['tb'] + "&ref=" + searchVars['pgb']['ref'] + "&av" + box + "=" + searchVars['sb' + box]['av'] + "&zn" + box + "=" + searchVars['sb' + box]['zn'] + "&va" + box + "=" + searchVars['sb' + box]['va'] + "&ca" + box + "=" + searchVars['sb' + box]['ca'] + "&limit=" + searchVars['sb' + box]['limit'] + "&sv" + box + "=" + searchVars['sb' + box]['sv'] + "&nm" + box + "=" + searchVars['pgb']['nm'] + "&co" + box + "=" + searchVars['sb' + box]['co'];		
	
						} else {
						
						
							if((searchVars['sb' + box]['tb'] == 'testimonials')) {
								
								queryString = "pagename=" + searchVars['sb' + box]['pn'] + "&self=" + searchVars['pgb']['self'] + "&page" + box + "=" + searchVars['sb' + box]['page'] + "&tb" + box + "=" + searchVars['sb' + box]['tb'] + "&va" + box + "=" + searchVars['pg' + box]['nm'] + "&limit=" + searchVars['sb' + box]['limit'];		
								
								
							} else {
							
								queryString = "pagename=" + searchVars['sb' + box]['pn'] + "&self=" + searchVars['pgb']['self'] + "&page" + box + "=" + searchVars['sb' + box]['page'] + "&tb" + box + "=" + searchVars['sb' + box]['tb'] + "&ref=" + searchVars['pgb']['ref'] + "&av" + box + "=" + searchVars['sb' + box]['av'] + "&zn" + box + "=" + searchVars['sb' + box]['zn'] + "&va" + box + "=" + searchVars['sb' + box]['va'] + "&ca" + box + "=" + searchVars['sb' + box]['ca'] + "&limit=" + searchVars['sb' + box]['limit'] + "&sv" + box + "=" + searchVars['sb' + box]['sv'] + "&nm" + box + "=" + searchVars['pgb']['nm'];		
							
							}
							
						}
						
					}
						
				}
			
			}
			
	}

		$("#sb" + box + "_liner").load("/ajax/display" + box + ".php?" + queryString, function(){
					
				$(".sb_spinner").hide("fast");
				curvyCorners.redraw();	
			});

			
		
	}
	
	function paginCo(box, num) {

		//$("#sb" + box + " .sb_spinner").show("slow");

		switch(num)
			{
			case 0:
				searchVars['sb'+box]['pagec'] = $("#sb" + box + "_courselist .ibpl_last").val();
			  break;
			case 1:
				searchVars['sb'+box]['pagec'] ++ ;
			  break;
			case 2:
			  break;
			case 3:
				searchVars['sb'+box]['pagec'] = searchVars['sb'+box]['pagec'] - 1 ;
			  break;
			case 4:
				searchVars['sb'+box]['pagec'] = 0;
			  break;
			}
			
						
						queryString = "box=" + box + "&nm=" + searchVars['pgb']['nm'] + "&pagec=" + searchVars['sb' + box]['pagec'] + "&co=" + searchVars['sb' + box]['co'];		

		$("#sb" + box + "_courselist").load("/ajax/displaycoursevids.php?" + queryString, function(){
					
				//$(".sb_spinner").hide("fast");
				curvyCorners.redraw();	
			});



			
		
	}
	//close popups
	
	$("#sbb p.sb_close a").live('click',function(event){
		
		greyBox('b', 'close');
		event.preventDefault();
		
	});
	
	$("#sbl p.sb_close a").live('click',function(event){
		
		greyBox('l', 'close');
		event.preventDefault();
		
	});
	
	//sbl menu popup
	
	$("#sbl h4.sb_menu a").live('click',function(event){
		
		
			greyBox('l', 'sbl_menu');
			$("#sbl .sb_cont").load("/ajax/sb_menu.php?box=l&tb=" + searchVars['sbl']['tb'] + "&pagename=" + searchVars['pgb']['pn'] + "&nm=" + searchVars['pgb']['nm']);
			
			event.preventDefault();

		});
	
	//sbb menu popup
	
	$("#sbb h4.sb_menu a").live('click',function(event){
		
		
			greyBox('b', 'sbb_menu');
			$("#sbb .sb_cont").load("/ajax/sb_menu.php?box=b&tb=" + searchVars['sbb']['tb'] + "&pagename=" + searchVars['pgb']['pn'] + "&nm=" + searchVars['pgb']['nm']);
			event.preventDefault();

		});

	//sbl search popup
	
	$("#sbl h4.sb_search a").live('click',function(event){
		

			greyBox('l', 'sbl_search');
			$("#sbl .sb_cont").load("/ajax/sb_search.php?box=l&tb=" + searchVars['sbl']['tb']+ "&limit=" + searchVars['sbl']['limit'] + "&zn=" + searchVars['sbl']['zn'] + "&ref=" + searchVars['pgb']['ref'] + "&sv=" + searchVars['sbl']['sv'] + "&ca=" + searchVars['sbl']['ca'] + "&va=" + searchVars['sbl']['va'] + "&av=" + searchVars['sbl']['av'] + "&ag=" + searchVars['sbl_p']['ag'] + "&sx=" + searchVars['sbl_p']['sx'] + "&ct=" + searchVars['sbl_p']['ct']);
			event.preventDefault();

		});

	//sbb search popup
	
	$("#sbb h4.sb_search a").live('click',function(event){
		

			greyBox('b', 'sbb_search');
			$("#sbb .sb_cont").load("/ajax/sb_search.php?box=b&tb=" + searchVars['sbb']['tb']+ "&limit=" + searchVars['sbb']['limit'] + "&zn=" + searchVars['sbb']['zn'] + "&ref=" + searchVars['pgb']['ref'] + "&sv=" + searchVars['sbb']['sv'] + "&ca=" + searchVars['sbb']['ca'] + "&va=" + searchVars['sbb']['va'] + "&av=" + searchVars['sbb']['av'] + "&ag=" + searchVars['sbb_p']['ag'] + "&sx=" + searchVars['sbb_p']['sx'] + "&ct=" + searchVars['sbb_p']['ct']);
			event.preventDefault();

		});
	
	
	//comments vid
	
	//reply to
	
	$(".reply_to p").live('click',function(event){
		
		if($(this).parent().prev().prev().length == 0) {
			
			var comment_id = $(this).next().val();
			$(this).parent().load("/ajax/reply_to.php?id=" + comment_id, function(){
				
				$(this).css({width: '70%'});
				$(this).find("p").css({cursor: 'default'});
				
			});
			
			$(this).parent().parent().prepend("<div title=\"sss\" class=\"reply_to\"></div>\n<div class=\"separator\"><!-- xxxxxxxxxxx --></div>\n");

			$(this).parent().prev().prev().load("/ajax/reply_to.php?rp2=1&id=" + comment_id, function(){
				
			if($(this).html().length == 0) {
				$(this).hide();
			}
			//alert($(this).html().length);
				
				
			});
		}
		
	});
	
	//hide thread
	
	$(".rp_close a").live('click',function(event){
		
		paginBox('l', 2);
		event.preventDefault();
	});
	
	//replies
	
	$("p.show_rp a").live('click',function(event){
		
		if($(this).parent().siblings().length == 0) {
			//alert($(this).parent().parent().prev().html());
		
			var comment_id = $(this).parent().parent().prev().find('input').val();
			$(this).parent().after('<p class="rp_close"><a href="#">close</a></p>');
	
			$(this).parent().parent().after('<div class="reply_cont"></div>');
			$(this).parent().parent().next().load("/ajax/reply.php?id=" + comment_id);
		
		}
		
		event.preventDefault();
	});

	//hide thread
	
	$(".replies .rp_close a").live('click',function(event){
		
		$(this).parent().parent().next().remove();
		$(this).parent().remove();
		
		event.preventDefault();
	});

	//post comments popup
	
	$("#sbl .comment_list_box p a.pop_vid ").live('click',function(event){
		
			greyBox('l', 'sbl_video');
			$("#sbl .sb_cont").load("/ajax/sb_video.php?box=l&ref=" + $(this).attr('href').replace('/?ref=', ''));
			event.preventDefault();		
		
	});
		
	
	$("#sbb .comment_list_box p a-pop_vid ").live('click',function(event){
		
		
		
			greyBox('b', 'sbb_video');
			//$("#sbb .sb_cont").load("/ajax/sb_video.php?box=b&ref=" + $(this).attr('href').replace('/?ref=', ''));
			event.preventDefault();		
		
	});
		
	
	$("#sbl h3.post_comment a").live('click',function(event){
					
		cmt_id = $(this).parent().next().val();
		greyBox('l', 'sbl_post_comment');
		$("#sbl .sb_cont").load("/ajax/comment_post.php?box=l&cmt_id=" + cmt_id);
		event.preventDefault();
		
	});
	
	$("#sbb h3.post_comment a").live('click',function(event){
		
		cmt_id = $(this).parent().next().val();
		greyBox('b', 'sbb_post_comment');
		$("#sbb .sb_cont").load("/ajax/comment_post.php?box=b&cmt_id=" + cmt_id);
		event.preventDefault();
		
	});

// show fb comments

	$(".fb_btm_cmts").live('click',function(event){
		
		if($(this).parent().parent().next().length == 0) {
			//alert($(this).parent().parent().find('input').val());
		
			var comment_id = $(this).parent().parent().find('input').val();
			//$(this).parent().after('<p class="rp_close"><a href="#">close</a></p>');
	
			$(this).parent().parent().after('<div class="reply_cont"></div>');
			$(this).parent().parent().next().load("/ajax/fb_comment.php?id=" + comment_id);
		
		}
		
		event.preventDefault();
	});

// login popup

	$("#sbl_login").live('click', function(event){		
			sbl_pop = window.open('http://www.djtutor.com/secure/poplogin.php','','scrollbars=no,menubar=no,height=500,width=900,resizable=yes,toolbar=no,location=no,status=no');
			commentPostIntId = setInterval ( function() { checkPostLogin('l'); }, 3000 );
			event.preventDefault();
			
		});
	
	$("#sbb_login").live('click', function(event){		
			sbl_pop = window.open('http://www.djtutor.com/secure/poplogin.php','','scrollbars=no,menubar=no,height=500,width=900,resizable=yes,toolbar=no,location=no,status=no');
			commentPostIntId = setInterval ( function() { checkPostLogin('b'); }, 3000 );
			event.preventDefault();
			
		});
	
	function checkPostLogin(box) {

		if ($("#sb" + box + "_postCommentCheck").val() == 1) {
			
			clearInterval(commentPostIntId);
			
			
		} else {
			
			$("#sb" + box + " .sb_cont").load("/ajax/comment_post.php?box=" + box + "&cmt_id=" + cmt_id);
			
		}
	}
	
	//smileys
	
	$(".sb_postCommentSmileys a").live('click',function(event){
		$(this).parent().parent().children("textarea").val($(this).parent().parent().children("textarea").val() + ' ' +smileys[$(this).attr("title")] + ' ');
		$(this).parent().parent().children("textarea").focus();
		event.preventDefault();
		
	});
	
	//length restriction
	
	$(".sb_postCommentForm textarea").live('keyup paste input focus',function(){
		
		
		if ($(this).val().length > 480) {
			$(this).val($(this).val().substring(0, 480));
			$(this).siblings("p").children("span").text(0);
		} else {
			$(this).siblings("p").children("span").text(480 - $(this).val().length);
		}

		
		})
	
	//send comment
	
	$(".sb_postCommentForm input").live('click',function(event){
		
		var box = $(this).parents(".pop_box").attr("id").substr(2,1);
		var post_comment_text = escape($(this).siblings("textarea").val()).replace('+', '%2B');
	
		if(cmt_id.length){
			
			var cmt_split = cmt_id.split("/");
			var youtuberef = cmt_split[0];
			var comment_id = cmt_split[1];
			
		} else {
	
			var youtuberef = searchVars['pgb']['ref'];
			var comment_id = '';
			
		}
	
		var queryString = "?youtuberef=" + youtuberef + "&comment_id=" + comment_id + "&post_comment_text=" + post_comment_text ;
			$("#sb" + box + " .sb_cont").load("/authorization_files/authsubcomment.php" + queryString, function(){
				
				
				var fade = setTimeout ( function() { greyBox(box, 'close'); paginBox(box, 4); }, 2000 );
			
				
				});
			
			event.preventDefault();
			
	});

		
	//sbl menu
	
	$("#sbl_menu ul li a").live('click', function(event){
		
		greyBox('l', 'close');
		php2js('l');
		searchVars['sbl']['tb'] = $(this).text();
		if($(this).text() == 'videos' || $(this).text() == 'DJs' || $(this).text() == 'comments') {
			searchVars['sbl']['av'] = 1;
			searchVars['sbl']['limit'] = 4;
		} else {
			searchVars['sbl']['av'] = 0;
			searchVars['sbl']['ca'] = '';
			searchVars['sbl']['limit'] = 5;
		}
		paginBox('l', 4);	
		$("#sbl h4.sb_tb").text($(this).text());
		
		//show / hide search
		
		if($(this).text() == 'videos' || $(this).text() == 'comments'|| $(this).text() == 'DJs' || $(this).text() == 'market') {
			
			if($("#sbl h4.sb_search").length == 0) {
				$("#sbl h4.sb_tb").after('<h4 class=\"sb_search\"><a href=\"#\">search<span></span></a></h4>');
			}
			$("#sbl h4.sb_search").show();	
			
		} else {
			
			$("#sbl h4.sb_search").hide();
			
		}
		
		//profilez buttons
		
		$("#pro_link_stats p a").css({opacity: 0.99});
		
		if($(this).text() == 'videos') {
			$("#pro_link_stats p:contains('videos') a").css({opacity: 0});
			$("#pro_link_stats p:contains('videos-YT') a").css({opacity: 0.99});
		}	
		
		if($(this).text() == 'comments') {
			$("#pro_link_stats p:contains('comments') a").css({opacity: 0});
		}	
		


		event.preventDefault();
		
	 });
	 
	//sbb menu
	
	
	
	if($("#sbb .sb_tb").text() != 'videos' && $("#sbb .sb_tb").text() != 'DJs' && $("#sbb .sb_tb").text() != 'comments'&& $("#sbb .sb_tb").text() != 'market') {
			$("#sbb .sb_search").hide();
			//alert($(this).text());
	} 
	
	$("#sbb_menu .sb_cont ul li a").live('click', function(event){
		
		greyBox('b', 'close');
		php2js('b');
		searchVars['sbb']['tb'] = $(this).text();
			
		if($(this).text() == 'videos' || $(this).text() == 'DJs'|| $(this).text() == 'merchandise'|| $(this).text() == 'comments') {
			searchVars['sbb']['av'] = 1;
			searchVars['sbb']['limit'] = 10;
			
		} else {
			searchVars['sbb']['av'] = 0;
			searchVars['sbb']['ca'] = '';
			searchVars['sbb']['limit'] = 5;
		}
		
		if($(this).text() == 'videos' || $(this).text() == 'DJs' || $(this).text() == 'comments' || $(this).text() == 'market') {
			$("#sbb .sb_search").show('slow');
		} else {
			$("#sbb .sb_search").hide('slow');
		}
		paginBox('b', 4);
		$("#sbb h4.sb_tb").text($(this).text());

		event.preventDefault();
		
	 });	
	//profilez animation
	
	$("#pro_link_info p:first a, #pro_link_stats p:first a").css({ opacity: '0'})

	$("#pro_link_info p a").live('click', function(event){
		
			
				$("#pro_link_info p a").css({opacity: '.99'})
				
				$("#pro_para_info h3, #pro_para_info p").hide('fast');
			
				$(this).animate({  top: '-100px', opacity: '0'}, 'slow', function(){
	
					queryString = "nm=" + searchVars['pgb']['nm']  + "&col=" + $(this).text().substr(0,5);
					$("#pro_para_info").load("/ajax/pro_info.php?" + queryString, function(){
						
							$("#pro_para_info h3, #pro_para_info p").show('slow');
						
						});
					$(this).css({top: '0px'})
					
				});
			

		
		event.preventDefault();
		
	});
	
	$("#pro_link_stats p a").live('click', function(event){
		
		
		if($(this).parent().text().substr(0,9) == 'videos-YT') {
				
			pro_pop = window.open($(this).attr('href'),'','scrollbars=yes,menubar=yes,height=500,width=900,resizable=yes,toolbar=yes,location=yes,status=yes');

		} else {
			$("#pro_link_stats p a").css({opacity: '.99'})
			
			if($(this).parent().text().substr(0,7) == 'courses') {
				
				searchVars['sbl']['av'] = 1;
				searchVars['sbl']['limit'] = 5;
				searchVars['sbl']['tb'] = 'courses';
				
				$("#sbl h4.sb_tb").text('courses');
				
				//hide search
				$("#sbl h4.sb_search").hide();

				
			}
			if($(this).parent().text().substr(0,6) == 'videos') {
				
				searchVars['sbl']['av'] = 1;
				searchVars['sbl']['limit'] = 4;
				searchVars['sbl']['tb'] = 'videos';
				searchVars['sbl']['va'] = searchVars['pgb']['nm'];
				
				$("#sbl h4.sb_tb").text('videos');

				//show search
				if($("#sbl h4.sb_search").length == 0) {
					$("#sbl h4.sb_tb").after('<h4 class=\"sb_search\"><a href=\"#\">search<span></span></a></h4>');
				}
				$("#sbl h4.sb_search").show();
				
			}
			if($(this).parent().text().substr(0,8) == 'comments') {
				
				searchVars['sbl']['av'] = 1;
				searchVars['sbl']['limit'] = 5;
				searchVars['sbl']['tb'] = 'comments';
				searchVars['sbl']['va'] = '';
				$("#sbl h4.sb_tb").text('comments');
				
				//show search
				if($("#sbl h4.sb_search").length == 0) {
					$("#sbl h4.sb_tb").after('<h4 class=\"sb_search\"><a href=\"#\">search<span></span></a></h4>');
				}
				$("#sbl h4.sb_search").show();
				
				
			}
			paginBox('l', 4);	
	
			$(this).animate({  height: '300px', width: '300px', left: '700px', top: '-300px', opacity: '0'}, function(){
				
				$(this).css({  height: '2em', width: '6.5em', left: '0px', top: '0px'})
				
			});

		}
		
		event.preventDefault();
		
	});
	
	//external links
	
	$("#pro_link_contact p:not('#pro_link_sk', #pro_link_fb, #pro_link_tw') a").live('click',function(event){
		pro_pop = window.open($(this).attr('href'),'','scrollbars=yes,menubar=yes,height=500,width=900,resizable=yes,toolbar=yes,location=yes,status=yes');
		event.preventDefault();
	});
	
	$("#pro_link_fb a").live('click',function(event){
		
			$("#pro_link_contact p a").css({opacity: '.99'})
			
				
				searchVars['sbl']['tb'] = 'facebook';
				searchVars['sbl']['va'] = searchVars['pgb']['nm'];
				
				$("#sbl h4.sb_tb").text('facebook');
				$("#pro_link_stats p a").css({opacity: 0.99});
				
			paginBox('l', 4);
			
			
	
			$(this).animate({  height: '300px', width: '300px', left: '700px', top: '-300px', opacity: '0'}, function(){
				
				$(this).css({  height: '2em', width: '6.5em', left: '0px', top: '0px', opacity: '.99'})
				
			});
			
			//hide search
			$("#sbl h4.sb_search").hide();
			
			event.preventDefault();

	});
	
	$("#pro_link_tw a").live('click',function(event){
		
			$("#pro_link_contact p a").css({opacity: '.99'})
			
				
				searchVars['sbl']['tb'] = 'twitter';
				searchVars['sbl']['va'] = searchVars['pgb']['nm'];
				
				$("#sbl h4.sb_tb").text('twitter');
				$("#pro_link_stats p a").css({opacity: 0.99});
				
			paginBox('l', 4);	
	
			$(this).animate({  height: '300px', width: '300px', left: '700px', top: '-300px', opacity: '0'}, function(){
				
				$(this).css({  height: '2em', width: '6.5em', left: '0px', top: '0px', opacity: '.99'})
				
			});
			
			//hide search
			$("#sbl h4.sb_search").hide();
			
			event.preventDefault();

	});
	
	$("#pro_link_sk a").live('click',function(event){
		
			$(".containerpro").append('<div id="containerpro_grey"></div><div class="pop_box" id="pro_link_pop"><p class="sb_close"><a href="#">close</a></p><div class="sb_cont"></div></div>');
			curvyCorners(curvySettings,"#containerpro_grey, .pop_box");
			$("#containerpro_grey").hide();
			$(".containerpro .pop_box").hide();		
			$("#containerpro_grey").fadeTo('slow', 0.8);
			$(".containerpro .pop_box").fadeTo('slow', 0.99);
				queryString = "nm=" + searchVars['pgb']['nm']  + "&col=skype";
				$("#pro_link_pop .sb_cont").load("/ajax/pro_info.php?" + queryString);
				
				
			
		event.preventDefault();
	});
	
	$("#pro_link_pop p.sb_close a").live('click',function(event){
		
			$(".containerpro .pop_box").empty();				
			$("#containerpro_grey, .containerpro .pop_box").fadeOut('slow', function() {
				$("#containerpro_grey, .containerpro .pop_box").detach();
			});			
			event.preventDefault();

	});
	
	
	
	//pop profilez
	
	$("#sbl a.pop_profile").live('click',function(event){
		
		if(searchVars['pgb']['ref'] || searchVars['sbl']['tb'] != 'DJs') {
			
			//var name = $(this).text();
			//if(name == '') {name = $(this).attr("title");}
			var link = $(this).attr("href");
			greyBox('l', 'sbl_profile');
			$("#sbl .sb_cont").load("/ajax/pop_profile.php?link=" + link);
			
			event.preventDefault();
		}

	});

	$("#sbb a.pop_profile").live('click',function(event){
		
		if(searchVars['pgb']['ref'] || searchVars['sbb']['tb'] != 'DJs') {

			//var name = $(this).text();
			//if(name == '') {name = $(this).attr("title");}
			var link = $(this).attr("href");
			greyBox('b', 'sbb_profile');
			$("#sbb .sb_cont").load("/ajax/pop_profile.php?link=" + link);
			event.preventDefault();

		}
	});

	 
	//sbl search form
	
	$("#sbl_submit_btn").live('click', function(event){
		
		if(searchVars['sbl']['tb'] == 'fb') {searchVars['sbl']['tb'] = 'videos';}
		greyBox('l', 'close');
		paginBox('l', 4);
			
		event.preventDefault();
		
	 });
	 
	//sbb search form
	
	$("#sbb_submit_btn").live('click', function(event){
		
		greyBox('b', 'close');						
		paginBox('b', 4);
		event.preventDefault();
		
	 });
	
	
	$(".course h4 a").live('click', function(event){
		
		
		searchVars['sb' + $(this).parent().parent().parent().attr('id')[2]]['co'] = $(this).parent().parent().attr('name');
		searchVars['sb' + $(this).parent().parent().parent().attr('id')[2]]['tb'] = 'courses';

		paginBox($(this).parent().parent().parent().attr('id')[2], 2);
		
		
		event.preventDefault();
		
	 });

	$("h3#courselist_header span a").live('click', function(event){
		
		
		
		searchVars['sb' + $(this).parent().parent().parent().attr('id')[2]]['co'] = '';
		searchVars['sb' + $(this).parent().parent().parent().attr('id')[2]]['tb'] = 'courses';

		paginBox($(this).parent().parent().parent().attr('id')[2], 4);
		
		
		event.preventDefault();
		
	 });
	
	//sbb merchandise design
	
	$("#sbb .merch_design a").live('click', function(event){
				
		searchVars['sbb']['ds'] = $(this).attr('href').replace('/merch?ds=', '');
		paginBox('b', 2);
		event.preventDefault();
		
	 });
	
	
	// sbb pagination
		
	$("#sbb .ibpl0").live('click', function(event){
				
		paginBox('b', 0);	

		event.preventDefault();
		
	 });
	
	$("#sbb .ibpl1").live('click', function(event){
				
		paginBox('b', 1);	

		event.preventDefault();
		
	 });
	
	$("#sbb .ibpl2").live('click', function(event){
				
		paginBox('b', 2);	

		event.preventDefault();
		
	 });
	
	$("#sbb .ibpl3").live('click', function(event){
				
		paginBox('b', 3);	

		event.preventDefault();
		
	 });
	
	$("#sbb .ibpl4").live('click', function(event){
				
		paginBox('b', 4);	

		event.preventDefault();
		
	 });
	
	// sbl pagination
		
	$("#sbl .ibpl0").live('click', function(event){
				
		paginBox('l', 0);	

		event.preventDefault();
		
	 });
	
	$("#sbl .ibpl1").live('click', function(event){
		
		paginBox('l', 1);	

		event.preventDefault();
		
	 });
	
	$("#sbl .ibpl2").live('click', function(event){
				
		paginBox('l', 2);	

		event.preventDefault();
		
	 });
	
	$("#sbl .ibpl3").live('click', function(event){
				
		paginBox('l', 3);	

		event.preventDefault();
		
	 });
	
	$("#sbl .ibpl4").live('click', function(event){
				
		paginBox('l', 4);	

		event.preventDefault();
		
	 });
	
	
	// course vid pagination
		
	$(".ibpl0c").live('click', function(event){
		
		
				
		paginCo($(this).parent().parent().attr('id')[2], 0);	

		event.preventDefault();
		
	 });
	
	$(".ibpl1c").live('click', function(event){
		
		
		paginCo($(this).parent().parent().attr('id')[2], 1);	

		event.preventDefault();
		
	 });
	
	$(".ibpl2c").live('click', function(event){
				
		paginCo($(this).parent().parent().attr('id')[2], 2);	

		event.preventDefault();
		
	 });
	
	$(".ibpl3c").live('click', function(event){
				
		paginCo($(this).parent().parent().attr('id')[2], 3);	

		event.preventDefault();
		
	 });
	
	$(".ibpl4c").live('click', function(event){
				
		paginCo($(this).parent().parent().attr('id')[2], 4);	

		event.preventDefault();
		
	 });
		
		
	
// search droplists
	
	$("#sbb_zn").live('change',function(){
		
		var sbbZnVal = $("#sbb_zn option:selected").val();
		
		var sbbVaVal = $("#sbb_va ").attr('type');
		
		if($("#sbb_zn option:selected").val() == 'tutor' && $("#sbb_va ").attr('type') == 'text') {
			
			$("#sbb_va").parent().load('/ajax/droplist.php?box=sbb&type=select');
			
		} 
		
		if($("#sbb_zn option:selected").val() != 'tutor' ) {
			
			$("#sbb_va").parent().load('/ajax/droplist.php?box=sbb&type=text', function(){
				
				
			});
			
		}
		
	})
		
	$("#sbl_zn").live('change',function(){
		
		var sbbZnVal = $("#sbl_zn option:selected").val();
		
		var sbbVaVal = $("#sbl_va ").attr('type');
		
		if($("#sbl_zn option:selected").val() == 'tutor' && $("#sbl_va ").attr('type') == 'text') {
			
			$("#sbl_va").parent().load('/ajax/droplist.php?box=sbl&type=select');
			
		} 
		
		if($("#sbl_zn option:selected").val() != 'tutor' ) {
			
			$("#sbl_va").parent().load('/ajax/droplist.php?box=sbl&type=text', function(){
				
				
			});
			
		} 
		//alert(fghjk + ' ' + rtyui);
		
	})
	
	
//suggest


	$("#sbb_va, #sbb_fba").live('keyup',function(event){
		
		if(!$("#sbb .suggest").length){
			
			$(this).after("<ul class=\"suggest\"></ul>");
			
			
		}
		val = $(this).val();
		zn =  ($(this).attr('id') == 'sbb_fba') ? 'fba' : $("#sbb_zn").val();
		
		if(event.keyCode == 40) {
			
			$(".suggest li a:first").focus();
			
		} else {
		
			$(this).next().load('/ajax/suggest.php?zn=' + zn + '&val=' + val, function(){
				
				if($(this).parent().find('li').length) {
					$("#sbb .suggest").fadeIn('fast');
				} else {
					$("#sbb .suggest").hide();
				}
					
			});
		
		}
		
	});
	
	$("#sbl_va, #sbl_fba").live('keyup',function(event){
		
		//alert($(this).attr('id'))
		
		if(!$("#sbl .suggest").length){
			
			$(this).after("<ul class=\"suggest\"></ul>");
			
			
		}
		val = $(this).val();
		zn =  ($(this).attr('id') == 'sbl_fba') ? 'fba' : $("#sbl_zn").val();
		
		if(event.keyCode == 40) {
			
			$(".suggest li a:first").focus();
			
		} else {
		
			$(this).next().load('/ajax/suggest.php?zn=' + zn + '&val=' + val, function(){
				
				if($(this).parent().find('li').length) {
					$("#sbl .suggest").fadeIn('fast');
				} else {
					$("#sbl .suggest").hide();
				}
					
			});
		
		}
		
	});

	$(".suggest li a").live('keypress',function(event){
		if(event.keyCode == 38 || event.keyCode == 40) {
		
		  event.preventDefault();
		  return false;
		}
	});
	
	$(".suggest li a").live('keyup',function(event){
		if(event.keyCode == 38) {
			if ($(this).parent().prev().length) {
				$(this).parent().prev().children().focus();
			} else {
				$(this).parent().parent().prev().focus();				
			}
		}
		if(event.keyCode == 40) {
			$(this).parent().next().children().focus();
		}
		event.PreventDefault();
	});
	
	$(".suggest li a").live('hover',function(){
		
		$(this).focus();
		
	});
		
	// fade autosuggest boxes
	
	$("#sbb_va").live('click', function(){
				
		$(".suggest").fadeOut('slow');
		
	});

	$("#sbb_va, .suggest li a").live('blur', function(){
				
		$(".suggest").fadeOut('slow');
		
	});

	$("#sbb_va").live('focus', function(){
		//alert('111');
				
		$(this).parent().find('ul').stop();
		
	});
	
	$(".suggest li a").live('focus', function(){
		//alert('111');
				
		
		$(this).parent().parent().stop();
		
	});
	//select suggestion
	
	$(".suggest li a").live('click',function(event){
		
		$(this).parent().parent().prev().val($(this).text());
		$(this).parent().parent().fadeOut('slow');
		
		event.preventDefault();
		
	});
	

	//footer
	
	$("#show_disclaimer a").live('click', function(event){
		
		//alert('tb=' + searchVars['pgb']['tb'] + ' zn=' + searchVars['pgb']['zn'] + ' va=' + searchVars['sbl']['va'] +'ca=' + searchVars['pgb']['ca'] + ' av=' + searchVars['pgb']['av'] + ' sv=' + searchVars['pgb']['sv'] + 'ref=' + searchVars['pgb']['ref']);
		// alert('dj');
	
		$("#short_footer").animate({  height: 'hide', width: 'hide', opacity: 'hide'}, 'slow');	
		$("#long_footer").animate({  height: 'show', width: 'show', opacity: 'show'}, 'slow', function(){
				
				curvyCorners(curvySettings,"#long_footer");	
			
			});	
      
		event.preventDefault();
		
	});

	$("#hide_disclaimer a").bind('click', function(event){
	
		$("#long_footer").animate({  height: 'hide', width: 'hide', opacity: 'hide'}, 'slow');	
		$("#short_footer").animate({  height: 'show', width: 'show', opacity: 'show'}, 'slow');	
         
		event.preventDefault();
		
	});

	//pro notes
	var proNotesID;
	var xo = 0;
	var yo = 0;

	//proNotesID = setInterval(proNotes, 3000);
	proNotes(0);
	
	function proNotes(i) {
			$('#pro_notes').show();	
		
		var d=Math.floor(Math.random()*5);
		var x=Math.floor(Math.random()*300) + 80;
		var y=Math.floor(Math.random()*90)		
		switch (d) {
			case 0: xo = 100; break;
			case 1: xo = 400; break;
			case 2: yo = 0; break;
			case 3: yo = 90; break;
					
		}
		$('#pro_notes').css({opacity : 0, left : xo, top : yo},  function(){
			});
		xo = x;
		yo = y;
		$('#pro_notes').css('fontSize', function() {
			return ((Math.floor(Math.random()*20) / 10) + 1) + 'em';
		});
		var f = (Math.floor(Math.random()*20) / 10) + 1
		//$('#pro_notes').animate({opacity : 0.99}, 4000)
		$('#pro_notes').animate({
				opacity : 0.99,
				left: x,
				top: y
		}, 3000, function() {
			$('#pro_notes').animate({opacity : 0}, 2000,  function(){
				if($("#pro_notes").text().length) {
					i++;
				} else {	
					i = 0;
				}
						

						$("#pro_notes").empty();
						
						proMusicArr = searchVars['pgb']['pro_music'].split(' ');
						$("#pro_notes").html(proMusicArr[i]);
						proNotes(i);
				;
			});
		});
	}
 
	$(".testimonial").live('click',function(){
		
				
				var id = $(this).children('p').attr('id');
				var source = $(this).children('h4').attr('name');
			
				if (confirm('Add comment?')) {
			
				
					$(this).children('h4').children('span').load("/ajax/add_comment.php?source=" + source + "&id=" + id);
			
				}			
		});
	

	$("#add_comment_div p.close").live('click',function(event){
		
				$("#add_comment_div").fadeOut('500', function(){
					
					$("#add_comment_div").remove();
					
					});

			
			
		});
	
	$("#add_comment_div h3").live('click', function(event){
		

		
			var id = $("#add_comment_div").parent().siblings(".post_comment_div").children('input').val();
		
				$("#add_comment_div").load("/ajax/add_comment.php?va=" + searchVars['sbl']['va'] + "&ca=" + searchVars['sbl']['ca'] + "&id=" + id);
				$("#add_comment_div").css({'background-color' : '#993399', 'height' : '30em'});
		
		})
	
	$("#add_comment_div button").live('click', function(event){
		
			var id = $("#add_comment_div").parent().siblings(".post_comment_div").children('input').val();
		
				$("#add_comment_div").load("/ajax/add_comment.php?va=" + searchVars['sbl']['va'] + "&ca=" + searchVars['sbl']['ca'] + "&id=" + id + "&btn=1");
				
			event.preventDefault();

		
		})
	
	$('#captcha_audio').live('click', function(event){
	    $('#captcha_sound').remove();
	    var file = $(this).attr('href');
	   // alert(file);
	    $('body').append('<embed id="captcha_sound" src="' + file + '" autostart="true" hidden="true" loop="false">');
		event.preventDefault();
	});
 	
});








////////////////////////////////////////////////////////////////////////////




function showMenu(my_id) {
	if (document.all&&document.getElementById(my_id)) {
	ul = document.getElementById(my_id);
	ul.style.display = 'block';
	}
	}

function hideMenu(my_id) {
	if (document.all&&document.getElementById(my_id)) {
	ul = document.getElementById(my_id);
	ul.style.display = 'none';
	}
	}
function expand(thistag){
  styleObj=document.getElementById(thistag).style;
  if(styleObj.display==='none'){styleObj.display='';}
  else {styleObj.display='none';}
}

// Attach event listeners to the buttons
function showSidebarListener() {

	
	if(!document.getElementById || !document.getElementById('sidebardetails') || !document.getElementById('wrapper') || !document.getElementById('container1') || !document.createElement)return;

  var sidebardetails, wrapper, container1;
  
  
  // Get the menu element to access the btn divs
  sidebardetails = document.getElementById('sidebardetails');
  pethau = sidebardetails.getElementsByTagName('ul');
  peth = pethau[0].getElementsByTagName('li');
  dolen = peth[0].getElementsByTagName('a');
  wrapper = document.getElementById('wrapper');
  containers = wrapper.getElementsByTagName('div');
  container1 = document.getElementById('container1');
  wts = container1.getElementsByTagName('div');
  
	for ( i=0; i<containers.length; i++ ) {

		if ( containers[i].className == 'containerextrawide' || containers[i].className == 'containernotsowide') {
		container = containers[i];
		}
		  peth[0].onclick = function(){ showSidebar(dolen[0]); showSidebar(dolen[1]); showSidebar(pethau[1]); showSidebar(pethau[2]); showSidebar(container); showSidebar(wts[1]); return false};
	
	
	}

	
}
// Attached to the buttons and ready to roll

function showSidebar(o) {
  // btn is our off state, so turn it on
  if (o.className == 'show_ref') {
    o.className = 'hide_ref';
  // Otherwise, turn it off
  } else {
  
	  if (o.className == 'hide_ref') {
		o.className = 'show_ref';
	  }
  }

  // btn is our off state, so turn it on
  if (o.className == 'show_ref_link') {
    o.className = 'hide_ref_link';
  // Otherwise, turn it off
  } else {
  
	  if (o.className == 'hide_ref_link') {
		o.className = 'show_ref_link';
	  }
  }

  if (o.className == 'containerextrawide') {
    o.className = 'containernotsowide';
  // Otherwise, turn it off
  } else {
  
	  if (o.className == 'containernotsowide') {
		o.className = 'containerextrawide';
	  }
  }

}


// Attach event listeners to the buttons
function dropSidebarListener() {

	
	if(!document.getElementById || !document.createElement)return;

  var flagnumber, i;
  var list = new Array();
  
  // Get the menu element to access the btn divs
  
  for (i=1; i<=12; i++) {
	  flagnumber = document.getElementById("flagnumber"+i);

	 
			  flagnumber.onclick = function(){  dropSidebar(this.getElementsByTagName('ul')[0]);};
  }

	
}
// Attached to the buttons and ready to roll

function dropSidebar(o) {
  // btn is our off state, so turn it on
  if (o.className == 'show_drop') {
    o.className = 'hide_drop';
  // Otherwise, turn it off
  } else {
  
	  if (o.className == 'hide_drop') {
		o.className = 'show_drop';
	  }
  }


}


function CountLeft(field, count, max) {
if (field.value.length > max) {
field.value = field.value.substring(0, max);
count.value = 0;
}//
else {
count.value = max - field.value.length;
}
}


function hide(o) {
    o.className = 'hidden';
}
function unhide(o) {
    o.className = '';
}

//Browser Support Code

function bannerlog(pagename, advertiser){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				
				return false;
			}
		}
	}

	var queryString = "?pagename=" + pagename + "&advertiser=" + advertiser ;
	ajaxRequest.open("GET", "/phillip/ajax_bannerlog.php" + queryString, true);
	ajaxRequest.send(null); 
}



function ajaxGeneral(node, page, queryString, separator){
	
	var node;
	var page;
	var queryString;
	var separator;
	
	if (!node) { return;}
	
	var ajaxRequest;  // The variable that makes Ajax possible!
//Browser Support Code
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				
				return false;
			}
		}
	}
	
	//separator?
	var sep;
	
	if (separator == 1) {
		
		sep = '<div class="separator"><!- xxxxxxxxxxx -></div>';
		
	} else {
		
		sep = '';
	
	}
	
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		
		if(ajaxRequest.readyState == 4){
			
			node.innerHTML = ajaxRequest.responseText + sep;
			
		}
		
	}
	var url =  "http://www.djtutor.com/ajax/" + page + ".php";
	ajaxRequest.open("GET", url + queryString, true);
	ajaxRequest.send(null); 
}

function setClass(node, dosbarth){
	
	node.className = dosbarth;

}



function confirmBox($confirmText) 
{

	if (confirm($confirmText)) {
		return true ;
	}
	else {
		return false ;
	}
}


function confirmPop($confirmText, destination) 
{

	if (confirm($confirmText)) {
		window.location= destination ;
	}
}

function clicklog(pagename, link_id){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				
				return false;
			}
		}
	}

	var queryString = "?pagename=" + pagename + "&link_id=" + link_id ;
	ajaxRequest.open("GET", "/phillip/ajax_clicklog.php" + queryString, true);
	ajaxRequest.send(null); 
}

//Browser Support Code
function ajaxFunction(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
			var ajaxDisplay = document.getElementById('ajaxDiv');
			ajaxDisplay.innerHTML = ajaxRequest.responseText;
		}
	}
	
	var istart = document.getElementById('istart').value;
	for ($i=istart; $i<=10; $i++){
		if (document.getElementById("rating_" + $i).checked == true) {
			var rating = $i;
		}
	}
	var ref = document.getElementById('ref').value;
	var username = document.getElementById('username').value;
	var queryString = "?ref=" + ref + "&rating=" + rating + "&username=" + username;
	ajaxRequest.open("GET", "/phillip/ajax-rate.php" + queryString, true);
	ajaxRequest.send(null); 
}

//Browser Support Code
function ajaxPersist(){
	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				
				return false;
			}
		}
	}
	
	ajaxRequest.open("GET", "/phillip/ajax_persist.php", true);
	ajaxRequest.send(null); 
}


/*
	Image Cross Fade Redux
	Version 1.0
	Last revision: 02.15.2006
	steve@slayeroffice.com

	Rewrite of old code found here: http://slayeroffice.com/code/imageCrossFade/index.html
*/

//window.addEventListener?window.addEventListener('load',so_init,false):window.attachEvent('onload',so_init);

var d=document, imgs = new Array(), zInterval = null, current=0, pause=false;

function so_init()
{
	if(!document.getElementById || !document.createElement || !document.getElementById('rotator'))return;

	css = document.createElement('link');
	css.setAttribute('href','/djtutorstyleslideshow2.css');
	css.setAttribute('rel','stylesheet');
	css.setAttribute('type','text/css');
	document.getElementsByTagName('head')[0].appendChild(css);

	imgs = document.getElementById('rotator').getElementsByTagName('img');
	for(i=1;i<imgs.length;i++) imgs[i].xOpacity = 0;
	imgs[0].style.display = 'block';
	imgs[0].xOpacity = .99;

	setTimeout(so_xfade,3000);
}

function so_xfade()
{
	cOpacity = imgs[current].xOpacity;
	nIndex = imgs[current+1]?current+1:0;
	nOpacity = imgs[nIndex].xOpacity;

	cOpacity-=.05;
	nOpacity+=.05;

	imgs[nIndex].style.display = 'block';
	imgs[current].xOpacity = cOpacity;
	imgs[nIndex].xOpacity = nOpacity;

	setOpacity(imgs[current]);
	setOpacity(imgs[nIndex]);

	if(cOpacity<=0)
	{
		imgs[current].style.display = 'none';
		current = nIndex;
		setTimeout(so_xfade,3000);
	}
	else
	{
		setTimeout(so_xfade,50);
	}

	function setOpacity(obj)
	{
		if(obj.xOpacity>.99)
		{
			obj.xOpacity = .99;
			return;
		}

		obj.style.opacity = obj.xOpacity;
		obj.style.MozOpacity = obj.xOpacity;
		obj.style.filter = 'alpha(opacity=' + (obj.xOpacity*100) + ')';
	}
}

function prepareHiddenInformation() {
	if (!document.getElementsByTagName) return false;	// Checks to make sure this function exists. Halts execution of script if not
	if (!document.getElementById) return false;	// Checks to make sure this function exists. Halts execution of script if not
	if (!document.getElementsByClassName('hidden_content')) return false;	// Checks to make sure this function exists. Halts execution of script if not

	
	var $hidden_content_boxes = document.getElementsByClassName('hidden_content');	// Gets list of all elements with class of 'hidden_content'
	for (var $i=0; $i<$hidden_content_boxes.length; $i++) {	// loops through the whole list...
		var $hidden_content_box = $hidden_content_boxes[$i];	// allocates each element to a variable (for easier reading)
		
		var $link = document.createElement('a');	// creates the toggle action link
		$link.onclick = function() {	// give the link an action when it is clicked. This action is as follows:
			if (this.getAttribute('status') == 'open') {	// if the link has a 'status' (internal variable) of 'open' the continue to close it, otherwise skip next 9 lines
				$hidden_content_box_id = this.getAttribute('rel');	// get the id of the box to be hidden from the link which has been clicked (each link is associated to a box)
				$hidden_content_box = document.getElementById($hidden_content_box_id);	// get the actual element to be hidden by its ID
				$hidden_content_box.style.display = 'none';	// give this element a CSS declaration of display:none; to hide it
				
				this.setAttribute('status','closed');	// update the link's status variable to 'closed'
				var $old_text = this.childNodes[0];	// get the old text (within the link element)
				this.removeChild($old_text);	// delete this old link text
				var $text = document.createTextNode('See last 10 comments');	// create new text saying 'More Information >>>'
				this.appendChild($text);	// Insert the new text within the link element
			}
			else {	// if the link does not have a 'status' (internal variable) of 'open' then it must be closed already. Continue to open it, otherwise skip next 9 lines
				$hidden_content_box_id = this.getAttribute('rel');	// get the id of the box which is no longer to be hidden from the link which has been clicked (each link is associated to a box)
				$hidden_content_box = document.getElementById($hidden_content_box_id);	// get the actual element no longer to be hidden by its ID
				$hidden_content_box.style.display = 'block';	// give this element a CSS declaration of display:block; to show it
				
				this.setAttribute('status','open');	// update the link's status variable to 'open'
				var $old_text = this.childNodes[0];	// get the old text (within the link element)
				this.removeChild($old_text);	// delete this old link text
				var $text = document.createTextNode('Hide comments');	// create new text saying 'Less Information <<<'
				this.appendChild($text);	// Insert the next text within the link element
			}
		}

		$link.setAttribute('title','Information');	// Give the link a non-specific title attribute
		$link.className = 'information_link';	// Give the link a class (for CSS styling)
		var $hidden_content_box_id = 'hidden_content'+$i;	// Create unique string 'hidden_content#' where '#' represents a unique integer and assign it to a variable
		$hidden_content_box.setAttribute('id',$hidden_content_box_id);	// Set the unique ID of the content as the unique value (above).
		$link.setAttribute('rel',$hidden_content_box_id);	// Set the 'rel' attribute with the same unique ID as above. This creates our associative connection between the link and the box it controls.
		var $text = document.createTextNode('See last 10 comments');	// Create a text string 'More Information >>>'. This will act as a default link text when inserted into the link (below)
		$link.appendChild($text);	// Set the link text from the string (above)
		var $parent = $hidden_content_box.parentNode;	// Get the content box's parent element and assign it to a variable
		$parent.insertBefore($link,$hidden_content_boxes[$i]);	// Insert the link into the parent element, directly before the content box which will be hidden



	}
}




// Function to return a list of elements with a specific class attribute
document.getElementsByClassName = function($class) {
	var $results = Array();
	var $elements = document.getElementsByTagName("*");
	for (var $i=0; $i<$elements.length; $i++) {
		var $classes = $elements[$i].className.split(" ");
		for (var $j=0; $j<$classes.length; $j++) {
			if ($classes[$j] == $class) {
				$results[$results.length] = $elements[$i];
			}
		}
	}
	return $results;
}


	window.onload = function() {
	 
	  //sbbListener();	 
	  showSidebarListener();
	  //dropSidebarListener();
	}
	
var curvyCornersVerbose = false;

// -->	

