
<!--
// Variables such as the main content frame
var targetframe="content_frame";
var openmode=1;

//Inserts the content of the hidden iframe into the dynamic div container...
function insertIt() {
	
	var _y = document.getElementById('container');
	var _x = window.frames[targetframe].document.body.innerHTML;
		
	_y.innerHTML = _x
} 

//Confirm a deletion
function delete_entry_confirm()
{
	input_box=confirm("Are you sure you want to Delete this entry?");
	if (input_box==true)
	{ 
		// Output when OK is clicked
		return true
	}
	else
		return false;
}

//Show hide a section..
function show_hide(loc, id, show) {
	if(document.getElementById){
		var foc=loc.firstChild;
		foc=loc.firstChild.innerHTML?loc.firstChild:loc.firstChild.nextSibling;
		foc.innerHTML=foc.innerHTML=='[+]'?'[-]':'[+]';
		
       		if (el = document.getElementById(id)) {
                	if (null==show) show = el.style.display=='none';
                	el.style.display = (show ? '' : 'none');
        	}
	}
}

//Used for the picture preview control
function preview(target, image, path){ 
	
	//alert(target);

        var img = document.getElementById(image); 
	var my_frame = document.getElementById(target).contentWindow.document;
		 
        my_frame.open(); 
        my_frame.clear(); 
	
        if(img.options[img.selectedIndex].text != '- No Image Selected -'){ 
		document.getElementById(target).style.visibility = 'visible'; 
		
        	my_frame.write('<style type=text/css>BODY {margin: 0;}</style>'); 
            	my_frame.write('<head><script language=JavaScript>function picLoad(target){var pic = new Image(); pic.src="' + path + img.options[img.selectedIndex].text + '";  document.images[0].src = pic.src; parent.setIframeHeight(target); }<\/script></head>'); 
            	my_frame.write('<body onload=picLoad(\'' + target + '\')><img src="' + path + img.options[img.selectedIndex].text + '"></body>');  }
        else {
		document.getElementById(target).height = 1; 
		document.getElementById(target).style.height = 1; 
		document.getElementById(target).style.visibility = 'hidden'; 
	}
	
	//alert('closing');
	my_frame.close(); 
}

//Used for the picture preview control
function setIframeHeight(target) {

        var my_height = document.getElementById(target).contentWindow.document.images[0].height;
	 
	document.getElementById(target).height = my_height;
        document.getElementById(target).style.height = my_height;
	
	
}

//This is a very unique function to force a post back to the products or options page with a new category_id
//This is needed to correctly populate the picture list boxes..
function jumpbox(list, dir, id){
	//var destination=eval("window.parent."+targetframe);
	var destination=document.getElementById(targetframe).contentWindow.document
	var my_list = document.getElementById(list); 
	var id_string = "";
	//var thebox=document.framecombo
	
	if(id!="")
		id_string = "&id=" + id;
	
	if (openmode==2)
		destination=window.parent;
	
	destination.location = dir + "/add_edit.vnss?cat=" + my_list.options[my_list.selectedIndex].value + id_string;
}

function popUp(URL, height, width) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=yes,left=200,top=200,height=' + height + ',width=' + width);");
}

// This function is  used to generate a preview of the image the user selected.
function showPicture(target, file)
{
	document.getElementById(target).src = "file:///" + document.getElementById(file).value;
}

//-->

