// © SMF-Media.com
// script.js
// Handler for uploading files using Yahoo UI Uploader
//
// Users of this software are bound by the terms of the
// SMG license. You can view it in the license_smg.txt file,
// or online at http://smf-media.com/smg/license.php
//  
// Support and updates for this software can be found at          
// http://smf-media.com

if (typeof(is_chrome) == 'undefined')
{
	var ua = navigator.userAgent.toLowerCase();
	var is_chrome = ua.indexOf('chrome') != -1;
	var is_safari = ua.indexOf('applewebkit') != -1 && !is_chrome;
}
function fixPictureSize(id)
{
	var pics = document.getElementById(id);
	if (pics == null || pics == 'undefined')
		return false;

	var clu = pics.getElementsByTagName('ul');
	for (var i = 0; i < clu.length; i++)
		if (clu[i].className.indexOf('pics') > -1)
			pics = clu[i];

	var lis = pics.getElementsByTagName('li');
	var max_width = 0, max_height = 0;
	for (i = 0; i < lis.length; i++)
	{
		if (lis[i].clientHeight > max_height + 12)
			max_height = lis[i].clientHeight - 12;
		if (lis[i].clientWidth > max_width + 12)
			max_width = lis[i].clientWidth - 12;
	}
	for (i = 0; i < lis.length; i++)
	{
		lis[i].style.height = max_height + 'px';
		lis[i].style.width = max_width + 'px';
	}
}
function selectText(box)
{
	box.focus();
	box.select();
}