function doSubmit(thisForm){
		document.forms[thisForm].submit();
};
function showHide(thisButton){
	doHide('showExtra_'+thisButton);
	doShow('hideExtra_'+thisButton);
}
function hideShow(thisButton){
	doHide('hideExtra_'+thisButton);
	doShow('showExtra_'+thisButton);
}

function AjaxUpdate(thisItem,thisPage) {
  $.get(thisPage, function(data) {
    $(thisItem).html(data);
   /* window.setTimeout(10000);*/
  });
}


function changePageTitle(newTitle){
	   $( 'title' ).html ('SoundOut - ' +newTitle);  	
}

function toggleAnything(thisDiv){
	var lastToggle = document.getElementById('lastToggle').value;
	$(document.getElementById(thisDiv)).toggle("blind",'',300);
	if(thisDiv != lastToggle){
		$(document.getElementById(lastToggle)).toggle("blind",'',300);
	}
	document.getElementbyId('lastToggle').value;
};
function simpleToggle(thisDiv){
	$(document.getElementById(thisDiv)).toggle("blind",'',300);
}

function doHide(thisDiv){
	$(document.getElementById(thisDiv)).hide();
};
function doShow(thisDiv){
	$(document.getElementById(thisDiv)).show();
};
function deleteFile(thisFile){
	$.post("./Framework/GlobalFileDelete.php", { FileId: thisFile} );
	location.reload();
};
function removeFromCart(thisItem){
	$.post("./Framework/GlobalCartRemove.php", { CartId: thisItem} );
	location.reload();
};
function removeVoucherFromCart(thisItem){
	$.post("./Framework/GlobalCartVoucherRemove.php", { CartId: thisItem} );
	location.reload();
};
function changeRepType(thisItem,changeTo,thisType){
	$.post("./Framework/GlobalCartRepValues.php", { ItemId: thisItem, newValue: changeTo, itemType: thisType} );
	location.reload();
};
function emptyCart(thisUser){
	$.post("./Framework/GlobalEmptyCart.php", { userId: thisUser} );
	location.reload();
};


function doRow(selectedId){
	var lastSelected = document.getElementById('lastSelected').value;
	var currentState = document.getElementById('currentState').value;
	
	$(document.getElementById('main_'+selectedId)).toggleClass( "highlightRow", 200 );
	$(document.getElementById('extra_'+selectedId)).toggle();
	
	if((currentState != 'Off') & (lastSelected == selectedId)){
		
		document.getElementById("currentState").value = 'Off';
	};
	
	if((currentState == 'Off') & (lastSelected != selectedId)){
		
		$(document.getElementById('main_'+lastSelected)).toggleClass( "highlightRow", 200 );
		$(document.getElementById('extra_'+lastSelected)).toggle();
		
		document.getElementById("currentState").value = 'On';
	};
	
	if((lastSelected != '') & (lastSelected != selectedId)){
		
		$(document.getElementById('main_'+lastSelected)).toggleClass( "highlightRow", 200 );
		$(document.getElementById('extra_'+lastSelected)).toggle();
	};
	
	document.getElementById("lastSelected").value = selectedId;   
};

$(function(){
  var arrVal = [ "1","3","4","7","8","9","10"];
  var arrAll = [ "1","2","3","4","5","6","7","8","9","10","11"];

  $("#reportLevel").change(function(){
    var valToCheck = String($(this).val());

    if ( jQuery.inArray(valToCheck,arrVal) == -1 )
    {
        $("#check").attr("checked", "true"); 
		$("#check").attr("disabled", "true"); 
		doHide('littlePrice');
		doShow('inclusivePrice');
		         
    }
    else
    {
		$("#check").removeAttr ( "checked" );
        $("#check").removeAttr ( "disabled" ); 
		doShow('littlePrice');
		doHide('inclusivePrice'); 
    } 
	
	if ( valToCheck == 3 ){
		doShow('helper_Standard');
		doHide('helper_Plus');
		doHide('helper_Express');	
		doHide('helper_Free');
	}
	if ( valToCheck == 4 ){
		doShow('helper_Express');
		doHide('helper_Plus');
		doHide('helper_Standard');	
		doHide('helper_Free');
	}
	if ( valToCheck == 2 ){
		doShow('helper_Plus');
		doHide('helper_Express');
		doHide('helper_Standard');	
		doHide('helper_Free');
	}
	
	if ( valToCheck == 1 ){
		doShow('helper_Free');
		doHide('helper_Plus');
		doHide('helper_Express');
		doHide('helper_Standard');	
	}
	
	
	if ( jQuery.inArray(valToCheck,arrAll) == -1){
		doHide('helper_Plus');
		doHide('helper_Express');
		doHide('helper_Standard');
		doHide('helper_Free');
	}
	
	
	       
  });
});


$(document).ready(function() {
if (  $.support.opacity) {
 /*do something for old (non css3)  browsers*/
}
	
$(".contentTextarea").markItUp(mySettings);

$("#forgottenPassword").fancybox({
				'titlePosition'	: 'over'	
			});
			
$("a.fancylink").fancybox(); 

$('.fileHelper').fancybox();
			
$(".deleteFile").fancybox({
				'titlePosition'	: 'over'
			});
$('.close-button').click(function(){
  $.fancybox.close();
});

$("#addTrax").fancybox({
				'titlePosition'	: 'over'	
			});				
					
$('#gallery_upload').uploadify({
						'uploader'  : '/Framework/widgets/uploadify/uploadify.swf',
						'script'    : '/Framework/GlobalGalleryUpload.php',
						'scriptData': { 'session': 100000},
						'cancelImg' : '/Framework/widgets/uploadify/cancel.png',
						'folder'    : 'Uploads/Gallery',
						'multi'	: true,
						'auto'      : true,
						'hideButton' : false,
						'wmode': "transparent",
						'simUploadLimit' : 1,
						
'onAllComplete' : function(event,data) {

       location.reload();

    },
						'onError': function (a, b, c, d) {
if (d.status == 404)
alert('Could not find upload script. Use a path relative to: '+'<?= getcwd() ?>');
else if (d.type === "HTTP")
alert('error '+d.type+": "+d.status);
else if (d.type ==="File Size")
alert(c.name+' '+d.type+' Limit: '+Math.round(d.sizeLimit/1024)+'KB');
else
alert('error '+d.type+": "+d.text);
}
					});					
					
$('input:checkbox:not([safari])').checkbox();
  $('input[safari]:checkbox').checkbox({cls:'jquery-safari-checkbox'});
  $('input:radio').checkbox();
				
					
		});
		
		
		
		
		

		
    
