// JavaScript Document

// Main Nav - Dynamic Menu
startList = function() {
	return;
	if (document.all&&document.getElementById) {
		navRoot = document.getElementById("nav");
		if(navRoot!=null)
		{		
			for (i=0; i<navRoot.childNodes.length; i++) {
				node = navRoot.childNodes[i];
				if (node.nodeName=="LI") {
					node.onmouseover=function() {
						this.className+="over";
					}
					node.onmouseout=function() {
						this.className=this.className.replace("over", "");
					}
				}
			}
		}
	}
}
//window.onload=startList;


// GLOBAL - Open Window
var newwin=null;

function pop(url,name,w,h) {    
	var Width;
	var Height;
	Width = (window.screen.width/2) - (w/2);
	Height = (window.screen.height/2) - (h/2);
	newwin=window.open(url,name,'width='+w+',height='+h+',left='+Width+',top='+Height+',screenX='+Width+',screenY='+Height+',toolbar=no,location=no,status=no,scrollbars=yes,resizable=yes');
	newwin.focus();
}
function modal(url,name,w,h) {    
	var Width;
	var Height;
	Width = (window.screen.width/2) - (w/2);
	Height = (window.screen.height/2) - (h/2);
	newwin=window.open(url,name,'width='+w+',height='+h+',left='+Width+',top='+Height+',screenX='+Width+',screenY='+Height+',toolbar=no,location=no,status=no,scrollbars=no,resizable=no');
	newwin.focus();
}


// Product Detail Pages - Tech Specs Pop-Up Window (links to CallawayGolf.com)
function popTechSpecs(modelID,productType,culture)
{
	if(culture=='ja')
	{
		pop('http://callawaygolf.com/ja/techspecs/specs.aspx?pid='+modelID+'&spectype='+productType,'specswin',650,600);
	}
	else if(culture=='ko')
	{
		pop('http://callawaygolf.com/ko/techspecs/specs.aspx?pid='+modelID+'&spectype='+productType,'specswin',650,600);
	}
	else
	{
		pop('http://callawaygolf.com/en/techspecs/specs.aspx?pid='+modelID+'&spectype='+productType,'specswin',650,600);
	}
}

function popWomensTechSpecs(modelID,productType,culture)
{
	pop('http://callawaygolf.com/en/techspecs/specs.aspx?w=1&pid='+modelID+'&spectype='+productType,'specswin',650,600);
}


// Pre-load Images
function preloadImage(src) {
    var img = new Image();
    img.src = src;
}

// Category Page - Promo Image Swap
function swapPromo(whichphoto)
{
document.images['ProdPhoto'].src = 'spree/images/products/' + whichphoto + 'cat-promo.jpg';
}

function swapPromoNew(domainName, whichphoto)
{
document.images['ProdPhoto'].src = domainName + '/images/products/' + whichphoto + 'cat-promo.jpg';
}


// Category Page - Thumbnail Mouseover
function swapThumb(whichthumb)
{
image_name = document.images[whichthumb].src;
is_on = image_name.indexOf('-on.jpg');
if (is_on == -1) {
	document.images[whichthumb].src = 'images/products/' + whichthumb + '-on.jpg';	
	} else {
	document.images[whichthumb].src = 'images/products/' + whichthumb + '-off.jpg';	
	}
}


// Product Detail Page - Technology Points
function showTech(whichPoint,pointCount)
{
for ( i=1; i<=pointCount; ++i ) {
	document.getElementById('prod-tech-copy-' + i).style.display = 'none';
	document.getElementById('tech-bullet-' + i).className = 'prod-tech-bullet-off';
	}
document.getElementById('prod-tech-copy-' + whichPoint).style.display = 'block';
document.getElementById('tech-bullet-' + whichPoint).className = 'prod-tech-bullet-on';
}
function showProductView(whichPoint,pointCount)
{
	for ( i=0; i<pointCount; ++i ) {
		document.getElementById('prod-view-' + i).style.display = 'none';
	}
	document.getElementById('prod-view-' + whichPoint).style.display = 'block';
}


// Product Selector - Display Context Help
function showHelp()
{
if (document.getElementById('helpBox').style.display == 'none')
	{
	document.getElementById('helpBox').style.display = 'block';
	} else {
	document.getElementById('helpBox').style.display = 'none';
	}
}

// Don't click submit twice
var clickCount = 0;
function disableButton (controlId)
{
	if(clickCount == 0)
	{
		clickCount = 1;
		return true;
	}
	else
	{
		
		return false;
	}
}
	
function checkRadioForItem(row)
{
	var cell = row.childNodes(1)
	var radio = cell.childNodes(0);
	radio.checked = true;
	radio.click();
}

function makeVisible(id)
{
	document.getElementById(id).style.visibility = 'visible';
}

function makeInvisible(id)
{
	document.getElementById(id).style.visibility = 'hidden';
}

function checkboxClicked()
{	
	var checkBox = document.getElementById( 'registerProduct_chkItemNotListed' );		
	if ( checkBox.checked )
	{		
		document.getElementById( 'selectManufacturer' ).style.visibility = 'hidden';	
		document.getElementById( 'selectModel' ).style.visibility = 'hidden';			
		document.getElementById( 'textModel' ).style.visibility = 'visible';						
		document.getElementById( 'textManufacturer' ).style.visibility = 'visible';				
		var serialNumberText = document.getElementById( 'textSerialNumber' );
		if ( serialNumberText != null )
		{
			document.getElementById( 'textSerialNumber' ).style.visibility = 'hidden';		
			document.getElementById( 'serialRowTitle' ).style.visibility = 'hidden';				
		}				
	}
	else
	{
		document.getElementById( 'selectManufacturer' ).style.visibility = 'visible';	
		document.getElementById( 'selectModel' ).style.visibility = 'visible';			
		document.getElementById( 'textModel' ).style.visibility = 'hidden';
		document.getElementById( 'textManufacturer' ).style.visibility = 'hidden';		
		var serialNumberText = 	document.getElementById( 'textSerialNumber' );
		if ( serialNumberText != null )
		{
			document.getElementById( 'textSerialNumber' ).style.visibility = 'visible';		
			document.getElementById( 'serialRowTitle' ).style.visibility = 'visible';
		}
	}
}