function init() {
	tinyMCEPopup.resizeToInnerSize();
}

function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

function insertghostpoolLink() {
	
	var tagtext;

	var style = document.getElementById('style_panel');
	
		var styleid = document.getElementById('style_shortcode').value;
		
		if (styleid != 0) {
			tagtext = "["+ styleid + "]Insert your text here[/' + styleid + '] ";
		}

		// Accordion Panels
		if (styleid != 0 && styleid == 'accordion') {
			tagtext = '['+ styleid + ']<br/>[panel title="Panel Title 1"]Insert your text here[/panel]<br/>[panel title="Panel Title 2"]Insert your text here[/panel]<br/>[panel title="Panel Title 3"]Insert your text here[/panel]<br/>[/' + styleid + ']';	
		}
		
		// Author Info
		if (styleid != 0 && styleid == 'author') {
			tagtext = '['+ styleid + ']';	
		}
		
		// Blockquotes
		if (styleid != 0 && styleid == 'bq_left') {
			tagtext = '['+ styleid + ']Insert your text here[/' + styleid + ']';	
		}		
		if (styleid != 0 && styleid == 'bq_right') {
			tagtext = '['+ styleid + ']Insert your text here[/' + styleid + ']';	
		}
		
		// Contact Form
		if (styleid != 0 && styleid == 'contact') {
			tagtext = '['+ styleid + ' email=""]';	
		}
		
		// Dividers
		if (styleid != 0 && styleid == 'divider') {
			tagtext = '['+ styleid + ']';
		}
		if (styleid != 0 && styleid == 'top_divider') {
			tagtext = '['+ styleid + ']';
		}
		if (styleid != 0 && styleid == 'small_divider') {
			tagtext = '['+ styleid + ']';
		}		
		if (styleid != 0 && styleid == 'clear') {
			tagtext = '['+ styleid + ']';
		}	
		if (styleid != 0 && styleid == 'small_clear') {
			tagtext = '['+ styleid + ']';
		}	
		
		// Tabs
		if (styleid != 0 && styleid == 'tabs') {
			tagtext = '['+ styleid + ']<br/>[tab title="Tab Title 1"]Insert your text here[/tab]<br/>[tab title="Tab Title 2"]Insert your text here[/tab]<br/>[tab title="Tab Title 3"]Insert your text here[/tab]<br/>[/' + styleid + ']';
			document.write (tagtext);
		}
		
		// Sidebar
		if (styleid != 0 && styleid == 'sidebar') {
			tagtext = '['+ styleid + ' name="default" width="" align="alignnone"]';	
		}
		
		// Toggle
		if (styleid != 0 && styleid == 'toggle') {
			tagtext = '['+ styleid + ' title=""]Insert your text here[/' + styleid + ']';	
		}	
		if (styleid != 0 && styleid == 'panel') {
			tagtext = '['+ styleid + ']Insert your text here[/' + styleid + ']';	
		}
		
		// Video
		if (styleid != 0 && styleid == 'video') {
			tagtext = '['+ styleid + ' name="video" url="" html5_1="" html5_2="" priority="flash" image="" width="470" height="320" align="alignnone" controlbar="bottom" autostart="false" stretching="fill" icons="true"]';	
		}
		
		// Columns
		if (styleid != 0 && styleid == 'two') {
			tagtext = '['+ styleid + ']Insert your text here[/' + styleid + '] ['+ styleid + '_last]Insert your text here[/' + styleid + '_last]';	
		}
		if (styleid != 0 && styleid == 'three') {
			tagtext = '['+ styleid + ']Insert your text here[/' + styleid + '] ['+ styleid + '_middle]Insert your text here[/' + styleid + '_middle] ['+ styleid + '_last]Insert your text here[/' + styleid + '_last]';	
		}	
		if (styleid != 0 && styleid == 'four') {
			tagtext = '['+ styleid + ']Insert your text here[/' + styleid + '] ['+ styleid + '_middle]Insert your text here[/' + styleid + '_middle] ['+ styleid + '_middle]Insert your text here[/' + styleid + '_middle] ['+ styleid + '_last]Insert your text here[/' + styleid + '_last]';	
		}	
		if (styleid != 0 && styleid == 'five') {
			tagtext = '['+ styleid + ']Insert your text here[/' + styleid + '] ['+ styleid + '_middle]Insert your text here[/' + styleid + '_middle] ['+ styleid + '_middle]Insert your text here[/' + styleid + '_middle] ['+ styleid + '_middle]Insert your text here[/' + styleid + '_middle] ['+ styleid + '_last]Insert your text here[/' + styleid + '_last]';	
		}			
		if (styleid != 0 && styleid == 'onethird') {
			tagtext = '['+ styleid + ']Insert your text here[/' + styleid + '] [twothirds_last]Insert your text here[/twothirds_last]';	
		}	
		if (styleid != 0 && styleid == 'twothirds') {
			tagtext = '['+ styleid + ']Insert your text here[/' + styleid + '] [onethird_last]Insert your text here[/onethird_last]';	
		}
		if (styleid != 0 && styleid == 'onefourth') {
			tagtext = '['+ styleid + ']Insert your text here[/' + styleid + '] [threefourths_last]Insert your text here[/threefourths_last]';	
		}
		if (styleid != 0 && styleid == 'threefourths') {
			tagtext = '['+ styleid + ']Insert your text here[/' + styleid + '] [onefourth_last]Insert your text here[/onefourth_last]';	
		}	
		
		if ( styleid == 0) {
			tinyMCEPopup.close();
		}
	
	if(window.tinyMCE) {
		//TODO: For QTranslate we should use here 'qtrans_textarea_content' instead 'content'
		window.tinyMCE.execInstanceCommand('content', 'mceInsertContent', false, tagtext);
		//Peforms a clean up of the current editor HTML. 
		//tinyMCEPopup.editor.execCommand('mceCleanup');
		//Repaints the editor. Sometimes the browser has graphic glitches. 
		tinyMCEPopup.editor.execCommand('mceRepaint');
		tinyMCEPopup.close();
	}
	return;
}
