function Bookmark(url, title){
	if(window.sidebar) { 
		window.sidebar.addPanel(title, url,""); 
	}
	else if(document.all){
		window.external.AddFavorite( url, title);
	}
}

function ChangeImage(obj, filename)
{
	obj.src = filename;
}

function SendQuestion(email_id, question_id){
	
	input_email = document.getElementById(email_id);
	input_question = document.getElementById(question_id);
	question_cell = document.getElementById('question-cell');
	
	error_msg = '';
	
	if(input_email.value.indexOf('@') == -1){
		error_msg = 'Please supply a valid email address';
	}
	if(input_question.value == ''){
		if(error_msg == ''){
			error_msg = 'Please enter a question';
		}
		else{
			error_msg += ' and enter a question';
		}
	}
	
	if(error_msg != ''){
		error_msg += ' and try again!';
		alert(error_msg);
		return;
	}
	
	html = '<h1 class="form-content-title" style="font-weight: normal;">Sending...</h1>';
	html += '<p>Your message is sending. Please wait.</p>'
	question_cell.innerHTML = html;
	
	Server_SendQuestion(input_email.value, input_question.value, UpdateQuestionArea);
}

function UpdateQuestionArea(server_data){
	question_cell = document.getElementById('question-cell');

	html = '<h1 class="form-content-title" style="font-weight: normal;">Email Sent!</h1>';
	html += '<p style="font-size: 12px">Your inquiry has been sent to the htmlBlender support department. A confirmation has been sent to <b>' + server_data + '</b>. Please allow a few minutes for delivery.</p>'
	html += '<p style="font-size: 12px">Thank you for contacting htmlBlender.</p>';
	html += '<p style="font-size: 12px"><a href="/helpdesk/index.php" target="_blank">htmlBlender HelpDesk</a></p>';
	
	question_cell.innerHTML = html;
}

function UploadFile(form_id, input_file_id, input_file_link_id){
	if(document.getElementById(input_file_id).value || document.getElementById(input_file_link_id).value){
		document.getElementById(form_id).submit();
	}
	else{
		alert('Click Browse to select file to upload or enter a link!');
	}
}

function DisplayBlock(id){
	obj = document.getElementById(id);
	if(obj){
		if(obj.style.display == 'none'){
			obj.style.display = '';
		}
		else{
			obj.style.display = 'none';
		}
	}
}
