

$(function() {
	
	$( "#share-window" ).dialog({
		title: 'Share this page to your friend',
		autoOpen: false,
		resizeable: false,
		width: 240,
		height: 190,
		modal: true
	});
	
	$( "#share-trigger" ).click(function() {
		$( "#share-window" ).dialog( "open" );
		$( "#share-name" ).select();
	});
	
});
	


/*******************************************************
 FORM FUNCTIONS

 *******************************************************/

function clearField(tar) {
	tar.value = '';
}

function fillField(tar, def) {
	if (tar.value == '')
		tar.value = def;
}

/*******************************************************
 TAB HIGHLIGHT FUNCTIONS

 *******************************************************/

function hlTab(tar) {
	
	if (tar == 'tab3') {
		document.getElementById('tab3').style.backgroundColor = '#999';
		document.getElementById('tab4').style.backgroundColor = '#DDD';
		document.getElementById('categorylist').style.display = 'block';
		document.getElementById('brandlist').style.display = 'none';
	} else {
		document.getElementById('tab4').style.backgroundColor = '#999';
		document.getElementById('tab3').style.backgroundColor = '#DDD';
		document.getElementById('categorylist').style.display = 'none';
		document.getElementById('brandlist').style.display = 'block';
	}
	
	return true;
	
}


function togle(id)
{
	if (document.getElementById(id).style.display == 'none') {
		return document.getElementById(id).style.display = 'block';
	} else {
		return document.getElementById(id).style.display = 'none';
	}
}

function togleSelect(id, tar)
{
	if(id.checked) {
		return document.getElementById(tar).style.backgroundColor = '#F6FCA4';
	} else {
		return document.getElementById(tar).style.backgroundColor = '#FFFFFF';
	}
}

function popupWindow(url, wi, he)
{
	newwindow = window.open(url, 'Detail picture', 'statusbar=0, toolbar=0, scrollbars=0, resizeable=0, width='+ wi +', height='+ he +'');
	if (window.focus) { newwindow.focus(); }
	return false;
}

