$( document ).ready(function() {
});

function skinSelector() {
	$("link[href*='user_skins']").remove();
	var thisSkin = $("div#SkinSelector input:checked").val() || $("#SkinSelector option:selected").val();
	halfDisplay(thisSkin);
	$("head").append('<link rel="stylesheet" href="/css/user_skins/' + thisSkin + '.css" type="text/css" />');
}

function toggleNames(divid) {
	$(divid).toggleClass("hideIt");
}

function halfDisplay(stylesheet) {
	var hl_array = new Array('Time_of_Introduction', 'Alternate_Terms');
	var acq_array = new Array('Likelihood_of_Exploit', 'Detection_Methods', 'Background_Details');
	var devmgr_array = new Array('Alternate_Terms',	'Modes_of_Introduction', 'Background_Details', 'Weakness_Ordinalities');
	var deved_array = new Array('Observed_Examples', 'Modes_of_Introduction', 'Other_Notes');
	var vulnres_array = new Array('Applicable_Platforms', 'Detection_Methods', 'Potential_Mitigations', 'Related_Attack_Patterns', 'Taxonomy_Mappings', 'Modes_of_Introduction', 'White_Box_Definitions', 'Other_Notes');
	var mapping_array = new Array('Terminology_Notes', 'Related_Attack_Patterns', 'Relationship_Notes', 'Theoretical_Notes');

	if (stylesheet=='acquisition') {
		for(var i=0; i<acq_array.length; i++) {
			$("div[id*='_" + acq_array[i] + "']").each(function(){
			var thisId = $(this).attr('id');
				toggleblocksOC(thisId.substring(3))
			});
		}	
	}
	else if (stylesheet=='dev_manager') {
		for(var i=0; i<devmgr_array.length; i++) {
			$("div[id*='_" + devmgr_array[i] + "']").each(function(){
			var thisId = $(this).attr('id');
				toggleblocksOC(thisId.substring(3))
			});
		}	
	}
	else if (stylesheet=='dev_ed') {
		for(var i=0; i<deved_array.length; i++) {
			$("div[id*='_" + deved_array[i] + "']").each(function(){
			var thisId = $(this).attr('id');
				toggleblocksOC(thisId.substring(3))
			});
		}	
	}
	else if (stylesheet=='vuln_research') {
		for(var i=0; i<vulnres_array.length; i++) {
			$("div[id*='_" + vulnres_array[i] + "']").each(function(){
			var thisId = $(this).attr('id');
				toggleblocksOC(thisId.substring(3))
			});
		}	
	}
	else if (stylesheet=='mapping_friendly') {
		for(var i=0; i<mapping_array.length; i++) {
			$("div[id*='_" + mapping_array[i] + "']").each(function(){
			var thisId = $(this).attr('id');
				toggleblocksOC(thisId.substring(3))
			});
		}	
	}

}