   function QSPair(newkey, newval){
  	   this.key = newkey;
  	   this.val = newval;
    } 
    
    function ParseQueryString()
    {
      var queryString = new Array();
      var urlSearch = location.search.substr(1);
      var parms = urlSearch.split("&");
      for(idx = 0; idx < parms.length; idx++) {
          if (parms[idx] != ""){
      			var parm = parms[idx].split("=");
      			queryString[queryString.length] = new QSPair(decodeURI(parm[0]), decodeURI(parm[1]));
  		    }
      }
      return queryString;
    } 

    function slideSwitch() {
      var $active = $('#headerimage IMG.active');
      if ($active!=null){
        if ( $active.length == 0 ) $active = $('#headerimage IMG:last');
          var $next =  $active.next().length ? $active.next()
          : $('#headerimage IMG:first');
          if($next[$next.length-1].nodeName=='IMG'){
            $active.addClass('last-active');

            $next.css({opacity: 0.0})
            .addClass('active')
            .animate({opacity: 1.0}, 1200, function() {
            $active.removeClass('active last-active');});
           } else {
	          $active.removeClass('active last-active');
           }
        }
    }
 
    $(function() {
       setInterval( "slideSwitch()", 4500 );
    });
        
    function showcomps(id){
        $.get("inc/menscomps.php",{pick:id},
        function(data){
            $('#maincontent').html(data);
        });
    }
    function showladiescomps(id){$('#maincontent').load("inc/ladiescomps.php?pick="+id);}
    function checkjuniorlogin(){
            $('#maincontent').load('inc/junioradmin.php?user='+ $('#user').attr('value')+ '&pwd=' + $('#pwd').attr('value'));
    }
    function juniorlogout(){
            $('#maincontent').load('inc/junioradmin.php?action=0');
    }
    function sendemail(){
        $('#emailstatus').show();
        $('#eselect input:checkbox:checked').each(function(index) {
            $.post("inc/sendemail.php", { emailaddress: $(this).val(), message: nicEditors.findEditor('emailtextarea').getContent()},function(data){$('#emailstatus').append(data);});
        });
        
    }
    function postcomments(){
          $.post('inc/yourcomments.php', { added: 'added', Name: $('#commentsname').attr('value'),Comments:$('#commentscomment').attr('value'),Club:$('#commentsclub').attr('value'),Country:$('#commentscountry').val()});
          $('#maincontent').load('inc/yourcomments.php?added=added');
    }
    function loadcontent(id){
        switch(id)
        {
        case 600: //Competitions
          $('#maincontent').load('inc/menscomps.php');
          break;
        case 400:
          $('#maincontent').load("inc/getcontentfromdb.php?id="+id,function(){
            $(".thickbox").colorbox({width:710,height:440});}
            );
          break;
        case 401:
          $('#maincontent').load("inc/getcontentfromdb.php?id="+id,function(){
            $(".thickbox").colorbox({width:730,height:480});}
            );
          break;
        case 303: //Your Comments
          $('#maincontent').load('inc/yourcomments.php');
          break;
        case 203:
          $('#maincontent').load('inc/juniorcomposeemail.php',function(){
            new nicEditor({maxHeight : 500}).panelInstance('emailtextarea');
          });
          break;
        case 202: //Junior Admin Section
          $('#maincontent').load('inc/junioradmin.php');
          break;
        case 201: //Junior Competitions
          $('#maincontent').load('inc/juniorcomps.php');
          break;
        case 101: //ladies Competitions
          $('#maincontent').load('inc/ladiescomps.php');
          break;
        default:
          $('#maincontent').load("inc/getcontentfromdb.php?id="+id);
        }
      } 
