/*---------------------------------------------------------------------------------------------------------*/
function Blur(elem, opacity) {
	
	Element.setOpacity(elem, opacity) 
	
}
function OpenTerms() {
	newwindow = window.open('terms.php','name','height=650,width=800,scrollbars=yes');
	if (window.focus) {newwindow.focus()}
}
/*--------------------------------------------------------------------------------------------------------*/
function AddComment() {
	
	var params = $('commentform').serialize();
	$('Error1').hide();
	$('Error2').hide();
	$('Error3').hide();
	$('commentform').disable();
	new Ajax.Request('../../ajax/addcomments.php', {
		method:'post',
		parameters: params,
		onSuccess: function(transport){
			var response = transport.responseText || "no response text";				
			res = response.split('***');
			errors = res.size();
			if (errors == 1) {	
				location.href='../../order.php';			
			}
			$('commentform').enable();
			res.each(function(s) {
				$('Error'+s).show();
			});
			$('Error').show();
			},
		onFailure: function(){ 
					alert('There was an error \n Please try again.')
					}
	});

}
/*--------------------------------------------------------------------------------------------------------*/
function ChangePhoto() {
	
	new Ajax.Request('ajax/changephoto.php', {
		method:'post',
		//parameters: params,
		onSuccess: function(transport){
			var response = transport.responseText || "no response text";				
			$('Accepted').show();
			x = CreateUpload();
			$('Upload').innerHTML = x;
			$('Upload').style.visibility = 'visible';
		},
		onFailure: function(){ 
					alert('There was an error \n Please try again.')
		}
	}); 

}
/*--------------------------------------------------------------------------------------------------------*/
function Preview() {
	
	var params = $('searchform').serialize();
	$('Error1').hide();
	$('Error2').hide();
	$('Error3').hide();
	$('Error4').hide();
	$('Error5').hide();
	$('Error6').hide();
	$('Error7').hide();
	$('Error').hide();
	$('searchform').disable();
	new Ajax.Request('ajax/preview.php', {
		method:'post',
		parameters: params,
		onSuccess: function(transport){
			var response = transport.responseText || "no response text";				
			res = response.split('***');
			errors = res.size();
			if (errors == 1) {	
				location.href='preview.php';			
			}
			$('searchform').enable();
			res.each(function(s) {
				$('Error'+s).show();
			});
			$('Error').show();
			},
		onFailure: function(){ 
					alert('There was an error \n Please try again.')
					}
	}); 

}
/*--------------------------------------------------------------------------------------------------------*/
function GetRegions(region) {
	
	var params = 'country=' + $F('country') + '&region='+region;
	
	new Ajax.Request('ajax/getregions.php', {
		method:'post',
		parameters: params,
		onSuccess: function(transport){
					var response = transport.responseText || "no response text";
					$('region').enable();
					$('REGIONS').update(response);
					},
		onFailure: function(){ 
					alert('There was an error \n Please try again.')
					}
	}); 

}
/*--------------------------------------------------------------------------------------------------------*/
function OpenSearch() {
	$('CH').hide();
	$('SF').show();
	$('SFB').show();
}
/*--------------------------------------------------------------------------------------------------------*/
function OpenCommentBox() {
	$('AddComment').hide();
	$('Comment').show();
}
/*--------------------------------------------------------------------------------------------------------*/
function SwapBTN(id,type,ext) {
	if (ext == "null") { ext='gif'; }
	if (type == 1) {
		$(id).src = 'gfx/btns/'+id+'over.'+ext;
	} else {
		$(id).src = 'gfx/btns/'+id+'.'+ext;
	}
}
function SwapBTN2(id,type,ext) {
	if (ext == "null") { ext='gif'; }
	if (type == 1) {
		$(id).src = '../../gfx/btns/'+id+'over.'+ext;
	} else {
		$(id).src = '../../gfx/btns/'+id+'.'+ext;
	}
}
/*--------------------------------------------------------------------------------------------------------*/
var is_cleared = Array();
function ClearBox(id) {		
	if (is_cleared[id]) {		
		return;		
	} else {	
		$(id).clear();
		is_cleared[id] = true;
	}	
}
/*--------------------------------------------------------------------------------------------------------*/