/**
** author: site120
** function : get script part from html document
**/
var loadJs = function(str , delayTime)
{
var delayTime = delayTime || 100;
var regExp_scriptTag = new RegExp("<\\s*script([^>]*)>([\\s\\S]*?)</\\s*script\\s*>" , "gi");
var regExp_scriptAttrib_src = new RegExp("\\s*src?\\s*=\\s*(\"([^\"]+)\"|\'([^\']+)\'|\\s*([^\\s]+)\\s*)" , "gi");
var arr_scriptTag = null;
var arr_scriptAttib = null;
var scriptData = "";
var jsList = new Array();
while ((arr_scriptTag=regExp_scriptTag.exec(str)) != null)
{
while ((arr_scriptAttib=regExp_scriptAttrib_src.exec(arr_scriptTag[1])) != null)
{
if (arr_scriptAttib[3])
{
jsList.push(arr_scriptAttib[3]);
}
else if (arr_scriptAttib[2])
{
jsList.push(arr_scriptAttib[2]);
}
else
{
jsList.push(arr_scriptAttib[1]);
}
}
scriptData += (arr_scriptTag[2]);
}
for (var i=0; i<jsList.length; i++)
{
var script = document.createElement("script");
script.src = jsList[i];
document.body.appendChild(script);
}
if (scriptData.length > 0)
{
var fn = "_siteFunction_" + new Date().getTime() + "_" + parseInt(Math.random()*10000) + "_120";
scriptData = " var " + fn + " = function(){ " + scriptData + " }; "+fn+"();"
window.eval(scriptData);
}
}