<?php
/**
 * @subpackage  tcshortcodes plugin
 */
//no direct accees
defined ('_JEXEC') or die('resticted aceess');

//[Row]
if(!function_exists('row_sc')) {
	$columnArray = array();
	function row_sc( $atts, $content="" ){
		global $columnArray;
		$id='';
		
		$params = shtcode_atts(array(
			  'id' => '',
			  'class' => ''
		 ), $atts);
		
		 if ($params['id']) 
			$id = 'id="' . $params['id'] . '"'; 
		
		do_shtcode( $content );
		
		//Row
		$html = '<div class="row-fluid ' . $params['class'] . '" ' . $id . '>';
		//Columns
		foreach ($columnArray as $key=>$value) $html .='<div class=' . $value['class'] . '>' . do_shtcode($value['content']) . '</div>';
		$html .='</div>';
	
		$columnArray = array();	
		return $html;
	}
	
	add_shtcode( 'row', 'row_sc' );
		
	//Row Items
	function span_sc( $atts, $content="" ){
		global $columnArray;
		$columnArray[] = array('class'=>$atts['class'], 'content'=>$content);
	}

	add_shtcode( 'col', 'span_sc' );			
}