/* PKL jQuery for the show page GUIDE co */

$(document).ready(function(){			
/*   Show Guide Section  */
/*  */
		 /* SUB   ///////////////////////////////////////////////////////////////////// */
					$("a#sub").click( function(){		
						//CLICK on 'SUB' 	makes "subdub=sub" to url        
						// goto the page with the new get string
						var showName = $("#showName").val();
						var getString = makeGetArguments( "subdub" , "sub" );
						//alert( 'getstring is...'+getString);
						location.href = '/'+showName+getString+'#guide';
						return false;
					});
		 /* DUB   ///////////////////////////////////////////////////////////////////// */
					$("a#dub").click( function(){		
						//CLICK on 'DUB' 	makes "subdub=sub" to url        
						// goto the page with the new get string
						var showName = $("#showName").val();
						var getString = makeGetArguments( "subdub" , "dub" );
						//alert( 'getstring is...'+getString);
						location.href = '/'+showName+getString+'#guide';
						return false;
					});
		 /* ALL   ///////////////////////////////////////////////////////////////////// */
					$("a#all").click( function(){		
						//CLICK on 'ALL' 	makes "subdub=sub" to url        
						// goto the page with the new get string
						var showName = $("#showName").val();
						var getString = makeGetArguments( "subdub" , "all" );
						//alert( 'getstring is...'+getString);
						location.href = '/'+showName+getString+'#guide';
						return false;
					});

		 /* RECENTLY ADDED   ///////////////////////////////////////////////////////////////////// */
					$("a#recently-added").click( function(){		
								//toggle the hidden value for orderby       
								$("#orderby-toggle").val("recently-added");
								var showName = $("#showName").val();								
								// get the subdub value
								var subDubVal    =   $("#subdub-selection").val();							
								//make the get string
								var getString = makeGetArguments( "subdub" , subDubVal );								
								//alert( 'getstring is...'+getString);								
								// goto the page with the new get string
								location.href = '/'+showName+getString+'#guide';
								return false;
							});
		/* ORDER (sequence in view) ///////////////////////////////////////////////////////////////////// */
					$("a#video-sequence").click( function(){		
								//toggle the hidden value for orderby
								$("#orderby-toggle").val("video-sequence");		
								var showName = $("#showName").val();		
								// get the subdub value
								var subDubVal    =   $("#subdub-selection").val();								
								//make the get string
								var getString = makeGetArguments( "subdub" , subDubVal );								
								//alert( 'getstring is...'+getString);								
								// goto the page with the new get string
								location.href = '/'+showName+getString+'#guide';
								return false;
							});
		/*  */
		/*  */									
});
		
function makeGetArguments( arg, argVal ){
		var orderBy           = $("#orderby-toggle").val();
		var getString = '?order='+orderBy+'&'+arg+'='+argVal ; // begin building the GET string		
		return getString;
}

function isLinkOn( id, onClass ){
	if(  $("a#"+id ).hasClass( onClass ) ){
				return true;
	}else{
				return false;
	}
}

