// JavaScript Document


function SendNewsletter()
{
	jQuery('#newsletter_submit').hide();
	
	jQuery.post( 'ajax_send_newsletter.php', { submitform: 'true', email: jQuery('#newsletter_email').val() }, function(data){
												alert(data);
												jQuery('#newsletter_submit').show();
											});
}

function OpenWindow( page, target )
{
	var pageProp= "toolbar=yes, location=yes, directories=yes, status=yes, menubar=yes, scrollbars=yes, resizable=yes";
	
	window.open( page, target, pageProp );
}

function OpenPopup(page, width, height )
{
	var pageProp= "toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=yes, resizable=yes, width="+ width +", height="+ height +", top=50, left=50";
	
	window.open(page,"",pageProp);
}

function ConfirmLink( theLink, question )
{
	var is_confirmed = confirm(question);
	if (is_confirmed) {
		theLink.href += '&is_js_confirmed=1';
	}

	return is_confirmed;
}

function ConfirmAction( theLink, question )
{
	var is_confirmed = confirm(question);
	if (is_confirmed) {
		return true;
	}

	return false;
}

function ShowMsg( msg )
{
	alert(msg);
}

<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->

function SincButtonWithCheck( idCheckBox, idButton )
{
	var button = document.getElementById(idButton);
	var check = document.getElementById(idCheckBox);
	
	button.disabled = check.checked;	
}

function AddToList( objList, sName, sValue, disabled )
{
	var opt = document.createElement('option');
	
	if( sName != '' )
	{
		opt.text = sName;
		opt.value = sValue;
		opt.disabled = disabled;
		
		try {
			objList.add(opt, null); // standards compliant; doesn't work in IE
		}
		catch(ex) {
			objList.add(opt); // IE only
		}
	}
}

function RemoveFromList( objList )
{	
	var i;
	for( i = objList.length - 1 ; i >= 0 ; i--)
	{
		if( objList.options[i].selected )
		{
			objList.remove(i);
		}
	}
}

function EraseAllList( objList )
{
	var i;
	for( i = objList.length - 1 ; i >= 0 ; i--)
	{
		objList.remove(i);
	}
}

function RemoveAllFromList( objList )
{
	SelectAllListItems( objList );
	RemoveFromList( objList );
}

function SelectAllListItems( selectList )
{
	for( var i = selectList.length - 1 ; i >= 0 ; i-- )
	{
		selectList.options[i].selected = true;
	}
}

function CallDelete( sType, sUrl, sData, successFnc )
{
	var is_confirmed = confirm("Are you sure you want to delete this item?");
	if (is_confirmed) {
		$.ajax({
			type: sType,
			url: sUrl,
			data: sData,
			success: successFnc
		});
	}
}

function CallAction( sType, sUrl, sData, successFnc )
{
	$.ajax({
		type: sType,
		url: sUrl,
		data: sData,
		success: successFnc
	});
}
