/**
 * Adodis Blog package
 * @author J-Extension <contact@jextn.com>
 * @link http://www.jextn.com
 * @copyright (C) 2012 - 2013 J-Extension
 * @license GNU/GPL, see LICENSE.php for full license.
**/

function blockSubmit(){
	document.adminForm.submit();
}

//For adding vedio url from popup
function addVideo(){
	var url 													= document.getElementById('video').value;
	var theurl													= document.getElementById('video');
	if( theurl != null ) {
		var tomatch= /http:\/\/[A-Za-z0-9\.-]{3,}\.[A-Za-z]{3}/
		if( theurl.value != '' ) {
		     if (tomatch.test(theurl.value)) {
		     } else {
		     	document.getElementById('video').style.border 	= "1px solid #FF0000";
				document.getElementById('video').focus();
				document.getElementById("video").title 			="Please Enter valid URL";
				return;
		     }
		}
	}
	var prefix_url 												= '<p>';
	var suffix_url 												= '</p>';
	url 														= prefix_url+url+suffix_url;
	window.parent.addIntoEditor(url);
}

//For adding vedio url to Editor
function addIntoEditor(url) {
	jInsertEditorText(url, 'jform_content');
	window.parent.SqueezeBox.close();
}

function bgColorOnChange(){
	var color 																	= document.getElementById('jform[bg_color]').value;
	document.getElementById('adodis-blog_sample_layout').style.backgroundColor 	= color;
}