//this changes class of the menu buttons for mousehover effect
function changeClass(className, td)
{
	td.className = className;
	return true;
}


function deleteItem(val,elmt,name)
{
	var answer	= confirm('Are you sure you want to delete this ' + name + '?');
	if( answer )
	{
		var fld		= document.getElementById(elmt);
		fld.value	= val;
		fld.form.submit();
	}
}

function changeStatus(sid,status,oid,status_order)
{
	var answer	= confirm('Are you sure you want to change the status of this order?');
	if( answer )
	{
		var fld1		= document.getElementById(status);
		fld1.value	= sid;
		
		var fld2		= document.getElementById(status_order);
		fld2.value	= oid;
		
		fld1.form.submit();
	}
}


function showPic(url, width, height)
{
	var win		= window.open('','_blank','toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=yes, width='+(width+20)+', height='+(height));
	win.document.write("<html><head></head><body onblur='window.close();' onload='window.focus();' style='margin: 0px; text-align: center;'><img src='"+url+"' alt='gallery picure' /></body></html>");
	win.document.close();
}

function launchWindow(url)
{
	window.open(url,"_blank","toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, copyhistory=yes, width=968, height=728");
}


function copyBillingAddress(name)
{
	var ary		= new Array('address','address2','city','province','country','pcode');
	for( i=0; i < ary.length; i++ )
	{
		id	= ary[i];
		b	= document.getElementById(name+'[b_'+id+']');
		s	= document.getElementById(name+'[s_'+id+']');
		if( b && s )
			s.value	= b.value;		
	}
}
