// Initial Field Value
function clearText(field){
	if(field.defaultValue == field.value){
		field.value = '';
	} else 
	if(field.value == ''){
		field.value = field.defaultValue;
	}
}


// Sort Menus
function sortMenu(selObj, menuID){
	var sortOpt = selObj.options[selObj.selectedIndex].value;
	
	if(sortOpt != '' || sortOpt != 0){
		document.location = sortOpt;
		document.getElementById(menuID).selectedIndex = 0;
	} else {
		document.getElementById(menuID).selectedIndex = 0;
	}
}


// Navigation Menu
var timeout	= 100;
var closetimer	= 0;
var ddmenuitem	= 0;

function menu_open(id){	
	null_close_timer();
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';
}

function menu_close(){
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

function close_timer(){
	closetimer = window.setTimeout(menu_close, timeout);
}

function null_close_timer(){
	if(closetimer){
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

function active(id){
	document.getElementById(id).style.backgroundImage = 'url(http://www.moviegoods.com/images/layout/btn-nav_on.gif)';
}

function inactive(id){
	document.getElementById(id).style.backgroundImage = '';
}

document.onclick = menu_close; 


// Element Toggle
function toggle(id, link) {
	var a = document.getElementById(id);
	
	if (a.style.display == 'block') {
		a.style.display = 'none';
	} else {
		a.style.display = 'block';
	}
}


// Top 10 Panels
var aItem;

function skuSwapAuto(panel, pos, mid, sku){
	if(panel == 'current'){
		aItem = 'top';
	} else {
		aItem = 'alltime';
	}
	
	document.getElementById(aItem + '10Auto').href = '/movie_product_static.asp?master_movie_id=' + mid + '&sku=' + sku;
	document.getElementById(aItem + '10AutoImg').src = '/assets/product_images/1010/' + sku + '.1010.a.jpg';

	for(i=1; i<11; i++){
		if(i == pos){
			document.getElementById(aItem + '10item' + pos).className = 'top10active';
		} else {
			document.getElementById(aItem + '10item' + i).className = 'top10text';
		}
	}
}

function skuSwapMan(panel, display, sku){
	if(panel == 'current'){
		aItem = 'top';
	} else {
		aItem = 'alltime';
	}
		
	document.getElementById(aItem + '10ManImg').src = '/assets/product_images/1010/' + sku + '.1010.a.jpg'
	
	if(display == 'on'){
		document.getElementById(aItem + '10Auto').style.display = 'none';
		document.getElementById(aItem + '10Man').style.display = 'block';
	} else {
		document.getElementById(aItem + '10Auto').style.display = 'block';
		document.getElementById(aItem + '10Man').style.display = 'none';
	}
}


// Frame Details
var win = null;

function frameDetails(mypage,myname,w,h,scroll) {
	LeftPosition = 0;
	TopPosition = 0;
	
	settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
	win = window.open(mypage,myname,settings)
}
