<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * 二手房后台系统共用函数文件
 *
 * @package     CodeIgniter
 * @subpackage  Helpers
 * @category    Helpers
 * @author      HOUSE365 ESF Dev Team
 * @link        http://nj.sell.house365.com/
 */

if( !function_exists('load_js') )
{
    /**
     * 加截javascript 文件
     * 
     * @param type $js_url  脚本路径名称，可以一维数组
     */
    function load_js($js_url)
    {
        $js = '';
        $js_url = explode(',', $js_url);
        if (is_array($js_url))
        {
            $strJs = '';
            foreach($js_url as $v)
            {
                if ($js != '') 
                {
                    $js .= "\n";
                }
                $strJs .= ',' . $v;
            }
            $debug = "";
            $js .= '<script type="text/javascript" src="'
                    . STATIC_SOURCE_URL . '/min/?'.$debug.'f=' . ltrim($strJs, ',').'&WebsiteVersion='.WebsiteVersion .'"></script>';

        } 
        else 
        {
	        $debug = "";

            $js .= '<script type="text/javascript" src="'
                    . STATIC_SOURCE_URL . '/min/?'.$debug.'f=' . ltrim($js_url).'&WebsiteVersion='.WebsiteVersion .'"></script>';
        }
        return $js;
    }
}


if( !function_exists('load_css') )
{
    /**
     * 加截css文件
     * 
     * @param type $css_url  样式路径名称，可以一维数组
     */
    function load_css($css_url)
    {
        $css = '';
        $css_url = explode(',', $css_url);
        if (is_array($css_url))
        {
            foreach($css_url as $v)
            {
                if ($css != '') 
                {
                    $css .= "\n";
                }
                $strCss .= ',' . $v;
            }
            $css .= '<link href="' .STATIC_SOURCE_URL . '/min/?f=' . ltrim($strCss, ',')  .'&WebsiteVersion='.WebsiteVersion
                  .'" rel="stylesheet" type="text/css">';
        }
        else 
        {

            $css .= '<link href="' .STATIC_SOURCE_URL . '/min/?f=' . ltrim($css_url) .'&WebsiteVersion='.WebsiteVersion
                        .'" rel="stylesheet" type="text/css">';
        }
        return $css;
    }
}