//
// special/temporary function
//
// detects a click with ctrl-alt pressed; if the condition exists, transfer is made to linkURL
//
function onmouseclick(e, linkURL){
	var href;

	if (typeof(linkURL) == 'string')
		href=linkURL;
	else
		href=linkURL.href;

	if (e.ctrlKey && e.altKey) {
		window.location=href;
	}
}

//
// for displaying mouse-hover popups created via <div> tags
//
//
// make the <div> visible
//
function ShowContent(d) {
	if(d.length < 1) { 
		return; 
	}
	ele = document.getElementById(d);
      ele.style.display = "block";
}
//
// make the <div> hidden
//
function HideContent(d) {
	if(d.length < 1) { 
		return; 
	}
	ele = document.getElementById(d);
      ele.style.display = "none";
}
//
// clear value of text box
//
function ClearText(d) {
	if(d.length < 1) { 
		return; 
	}
	ele = document.getElementById(d);
      ele.value = "";
}
//
// flip the display of the <div>
//
function ReverseContentDisplay(d) {
	if(d.length < 1) { 
		return; 
	}
	if(document.getElementById(d).style.display == "none") { 
		document.getElementById(d).style.display = "block"; 
	}
	else { 
		document.getElementById(d).style.display = "none";
	}
}


//
// manage pop-up windows
//
// display a pop-up window
//
// linkURL: the URL for the content of the window; can be a string of an anchor object
// windowname: determine the configuration of the pop-up window, see if-then-else structure below
//
function popup(linkURL, windowname) {
	if (! window.focus)return true;
	var href;

	if (typeof(linkURL) == 'string')
		href=linkURL;
	else
		href=linkURL.href;

	if (windowname == 'contactus')
 		window.open(href, windowname,
  			'width=400,height=200,left=80,top=25,resizable=yes,dependent=yes,scrollbars=yes');
	else if (windowname == 'termsofusage')
 		window.open(href, windowname,
  			'width=750,height=455,left=80,top=25,resizable=yes,dependent=yes,scrollbars=yes');
	else if (windowname == 'privacy')
 		window.open(href, windowname,
  			'width=610,height=268,left=80,top=25,resizable=yes,dependent=yes,scrollbars=yes');
	else if (windowname == 'shipping')
 		window.open(href, windowname,
  			'width=640,height=270,left=80,top=25,resizable=yes,dependent=yes,scrollbars=yes');
	else if (windowname == 'returns')
 		window.open(href, windowname,
  			'width=640,height=250,left=80,top=25,resizable=yes,dependent=yes,scrollbars=yes');
	else
 		window.open(href, windowname,
  			'width=610,height=170,left=80,top=25,resizable=yes,dependent=yes,scrollbars=yes');

	return false;
}
//
// this function closes a pop-up, sending control back to the window that opened the pop-up
//
// linkURL: an anchor object, can be used to change the content of the opener window
// closeme: boolean; true - close the pop-up; false - don't cloe the pop-up
// closeonly: boolean; true - only close the pop-up, do not change the content of the opener window
//                    false - do change the content of the opener window
//
function targetopener(linkURL, closeme, closeonly) {
	if (! (window.focus && window.opener))
		return true;
	window.opener.focus();
	if (! closeonly)
		window.opener.location.href=linkURL.href;
	if (closeme)window.close();
	return false; 
}

// This function returns Internet Explorer's major version number, 
// or 0 for others. It works by finding the "MSIE " string and 
// extracting the version number following the space, up to the decimal 
// point, ignoring the minor version number 
function msieversion() { 
	var ua = window.navigator.userAgent; 
	var msie = ua.indexOf ( "MSIE " );
 
	if ( msie > 0 ) // If Internet Explorer, return version number 
		return parseInt (ua.substring (msie+5, ua.indexOf (".", msie ))); 
	else // If another browser, return 0 
		return 0; 
} 

//
// this function set the proper display value for the corrent menu
//
function selectMenu() {
	var ver = msieversion();
	if ( ver > 7 || ver  == 0 ) { // IE 8 or browser other than IE
		document.getElementById('modernmenu').style.display = "block"; 
		document.getElementById('oldmenu').style.display = "none"; 
	} else {
		document.getElementById('modernmenu').style.display = "none"; 
		document.getElementById('oldmenu').style.display = "block"; 
	}
}

