//js for switching content on and off under a specific id
function selectObject(name,elementId) {
	if (!document.getElementById) return;
	var navRoot = document.getElementById(elementId);
	if (navRoot) {
		for (i=0; i<navRoot.childNodes.length; i++) {
			node = navRoot.childNodes[i];
			if (node.id == name) {
				node.className = "textOn";
			} else {
				node.className = "textOff";
			}
		}
	}
}

// turn items on or off, displayed or not displayed
function textOnOff() {
	for (var i=0; i < arguments.length; i++) {
		var item = document.getElementById(arguments[i]);
		if (item.className=="textOn") {
			item.className= "textOff";
		} else { 
			item.className= "textOn";
		}
	}
}
// turn items on or off, displayed or not displayed
function textOff() {
	for (var i=0; i < arguments.length; i++) {
		var item = document.getElementById(arguments[i]);
		if (item.className=="textOn") {
			item.className= "textOff";
		} 
	}
}
// turn items on or off, displayed or not displayed
function textOn() {
	for (var i=0; i < arguments.length; i++) {
		var item = document.getElementById(arguments[i]);
		if (item.className=="textOff") {
			item.className= "textOn";
		} 
	}
}

//grabs variables from the address bar
function getQueryVariable(variable) {
    var query = window.location.search.substring(1);
    var vars = query.split("&");
    for (var i=0;i<vars.length;i++) {
        var pair = vars[i].split("=");
        if (pair[0] == variable) {
          return pair[1];
        }
    } 
      //alert('Query Variable ' + variable + ' not found');
}

$(document).ready(
  
  function () {
		$('.dot-roll.current').attr('src','/wp/wp-content/themes/krak/images/dot-hover.png');
		$('.dot-roll').mouseover(function() {
			$('.portfolio-page img').hide();
			$('.dot-roll').attr('src','/wp/wp-content/themes/krak/images/dot.png');
			var showID = $(this).attr('show-id');
			$('.wp-image-'+showID).show();
			$(this).attr('src','/wp/wp-content/themes/krak/images/dot-hover.png');
		});
		$('.testimonial').mouseover(function() {
			$('.quotes img').hide();
			$('.testimonial').removeClass("selected");
			var quote = $(this).attr('id');
			$('.'+quote).show();
			$(this).addClass("selected");
		});
	}
);
