// JavaScript Document
function open_window(link,w,h) //opens new window
{ 

	var win = "width="+w+",height="+h+",menubar=no,location=no,resizable=yes,scrollbars=yes";
	newWin = window.open(link,'newWin',win);

}

function deleteIt(message, link,w,h)
{
	result = window.confirm(message);
	if (result) 
	{
		window.open = open_window(link,w,h);
	}
}

function Check(){

              return confirm("CAUTION: \nThis process will delete all images for this project\nPress cancel to abort.", "OK");

}
/*
Insert the follwing script in the <head> of the page,
usually right after the link rel='s. Set doAlerts=false;
to shut off the alert boxes when changing styles. 
http://www.codelifter.com/main/javascript/changestyles.html */

var doAlerts=false;
function changeSheets(whichSheet){
  whichSheet=whichSheet-1;
  if(document.styleSheets){
    var c = document.styleSheets.length;
    if (doAlerts) alert('Change to Style '+(whichSheet+1));
    for(var i=0;i<c;i++){
      if(i!=whichSheet){
        document.styleSheets[i].disabled=true;
      }else{
        document.styleSheets[i].disabled=false;
      }
    }
  }
}


function linkSelection(imageID){
		
		if (imageID == 'img11'){
			
			document.getElementById('img11').style.display = 'none';
			document.getElementById('img11Selected').style.display = 'inline';
			document.getElementById('img12').style.display = 'inline';
			document.getElementById('img12Selected').style.display = 'none';
			document.getElementById('img13').style.display = 'inline';
			document.getElementById('img13Selected').style.display = 'none';
			
		}
		
		if (imageID == 'img12'){
			document.getElementById('img11').style.display = 'inline';
			document.getElementById('img11Selected').style.display = 'none';
			document.getElementById('img12').style.display = 'none';
			document.getElementById('img12Selected').style.display = 'inline';
			document.getElementById('img13').style.display = 'inline';
			document.getElementById('img13Selected').style.display = 'none';
		}	
		
		if (imageID == 'img13'){
			document.getElementById('img11').style.display = 'inline';
			document.getElementById('img11Selected').style.display = 'none';
			document.getElementById('img12').style.display = 'inline';
			document.getElementById('img12Selected').style.display = 'none';
			document.getElementById('img13').style.display = 'none';
			document.getElementById('img13Selected').style.display = 'inline';
			
		}	

}
/*
function changeCSS(field){

	if (field == '11'){
			<link href="includes/buyingGuide2.css" rel="stylesheet" type="text/css">;
			
		}
		
		if (field == '13'){
			<link href="includes/buyingGuide3.css" rel="stylesheet" type="text/css">;
			
		}	
		else (field == '13'){
				<link href="includes/buyingGuide3.css" rel="stylesheet" type="text/css">;
				
			}	
}
*/

// onLoad event
window.onload = function(){
	set_scroll();
}
// if query string in URL contains scroll=nnn, then scroll position will be restored
function set_scroll(){
	// get query string parameter with "?"
	var search = window.location.search;
	// if query string exists
	if (search){
		// find scroll parameter in query string
		var matches = /scroll=(\d+)/.exec(search);
		// jump to the scroll position if scroll parameter exists
		if (matches) window.scrollTo(0, matches[1]);
	}
}

// append scroll value to the URL
function my_href(href){
	var scroll;
	// Netscape compliant
  if (typeof(window.pageYOffset) == 'number')
  	scroll = window.pageYOffset;
  // DOM compliant
  else if (document.body && document.body.scrollTop)
    scroll = document.body.scrollTop;
  // IE6 standards compliant mode
  else if (document.documentElement && document.documentElement.scrollTop)
    scroll = document.documentElement.scrollTop;
  // needed for IE6 (when vertical scroll bar is on the top)
  else scroll = 0;
	// set href location with scroll position parameter
	window.location.href = href + '&scroll=' + scroll;
}
