function setDate() {
	var date = new Date();
	return date.getFullYear()+'-'+(date.getMonth()+1)+'-'+date.getDate()+' '+date.getHours()+':'+date.getMinutes()+':'+date.getSeconds();
}

function stringToArray(input) {
	var data = new Array();
	var rows = input.split(',');
	for(var row in rows) {
		var tmp = rows[row].split('=');
		data[tmp[0]] = tmp[1];
	}
	return data;
}

function newWindow(title, target, width, height) {
	width = Number(width) + Number(20);
	height = Number(height) + Number(20);
	window = window.open(target, name, 'menubar=no, toolbar=no, location=no, scrollbars=no, resizable=no, status=no, width='+width+', height='+height+', top=50, left=50');
}

function photoWindow(target, width, height) {
	width = Number(width) + Number(20);
	height = Number(height) + Number(20);
	photo = window.open('', 'PHOTO', 'menubar=no, toolbar=no, location=no, scrollbars=no, resizable=no, status=no, width='+width+', height='+height+', top=50, left=50');
	photo.document.writeln('<html><body>');
	photo.document.writeln('<img src="'+target+'" onClick="photo.close(); return false;">');
	photo.document.writeln('</body></html>')
	photo.document.close();
}

function setCalendarDate(formName, fieldName, date, time) {
	window.opener.document.forms[0].date.value = date+' '+time;
	window.close();
}

function jumpToPage(site, page, limit, sort, order) {
	link = location.pathname+'?option='+site+'&task=listAll';
	if(page) {
		link += '&page='+page;
	}
	if(limit) {
		link += '&limit='+limit;
	}
	if(sort) {
		link += '&sort='+sort;
	}
	if(order) {
		link += '&order='+order;
	}
	location.replace(link);
}
