/**
* JavaScript loader
* @param modules {Array} массив имен js файлов
*/
var Queue = function () {
this.members = [];
};
Queue.prototype = {
add: function (f) {
if (f instanceof Function) {
this.members.push(f);
}
},
iterate: function () {
if (this.members.length > 0) {
var func = this.members.shift();
func.call(this);
}
},
clear: function () {
this.members = [];
}
};
var ScriptLoader = function (modules, id)
{
this.modules = modules.slice();
this.id = id;
this.queue = new Queue();
this._init();
};
ScriptLoader.prototype = {
run: function () {
// test for header ready
var head = document.getElementsByTagName("head");
// alert (head.lengt);
if (head.length > 0) {
this.queue.iterate();
} else {
setTimeout(arguments.callee, 500);
}
},
_init: function () {
var i, me = this;
for (i = 0; i < me.modules.length; i++) {
(function (name) {
me.queue.add(function () {
var head, script;
head = document.getElementsByTagName("head");
if (head.length > 0) {
head = head[0];
script = document.createElement("script");
script.src = name;
script.type = "text/javascript";
script.onload = script.onreadystatechange = function ()
{
if ((!this.readyState || this.readyState == "loaded" || this.readyState == "complete") )
{
me.queue.iterate();
script.onload = script.onreadystatechange = null;
}
};
head.appendChild(script);
}
});
})(me.modules[i]);
}
}
};
function InitPollStyleType()
{
var csshead, cssscript;
csshead = document.getElementsByTagName("head");
if (csshead.length > 0)
{
csshead = csshead[0];
cssscript = document.createElement("link");
cssscript.href = "http://ads.corbina.net/incl/poll/display/css/"+VarPollContainerSize+"/"+VarPollContainerFont+"/"+VarPollContainerColor+"/"+VarPollContainerTitleColor+"/"+VarPollContainerTitleSize+"/"+VarPollContainerSid+"/";
cssscript.type="text/css";
cssscript.rel = "stylesheet";
csshead.appendChild(cssscript);
}
}
function PreinitReLoadPollContainer(id)
{
//initReLoadPollContainer(id);
setTimeout("initReLoadPollContainer("+id+")", 1000);
}
function initReLoadPollContainer(id, block)
{
//alert (id);
var encoding, voted;
if(VarPollContainerEncode){encoding = VarPollContainerEncode+'/';}else{encodeing = '';}
if(block)
{
if(PollgetCookie('admvoted'+id) == 1){voted = '?voted=1';}
var Reloader = new ScriptLoader(["http://ads.corbina.net/incl/poll/display/polls/"+VarPollContainerSid+"/"+id+"/"+encoding+voted]);
}
else
{
var Reloader = new ScriptLoader(["http://ads.corbina.net/incl/poll/display/polls/"+VarPollContainerSid+"/"+id+"/"+encoding+"?voted=1"]);
}
//alert ("http://ads.corbina.net/incl/poll/display/polls/"+VarPollContainerSid+"/"+id+"/"+encoding+voted);
Reloader.queue.add(function()
{
setTimeout("endLoadPart('pollcorbinastyle_container"+id+"', '"+hjvrsPollVar[id]+"')", 1000);
//document.getElementById('pollcorbinastyle_container'+id).innerHTML = hjvrsPollVar[id]+'
';
});
Reloader.run();
if(!block) PollsetCookie('admvoted'+id, '1');
}
function InitListPolls(listedPolls)
{
InitPollsArray = listedPolls.slice();
for (i = 0; i < InitPollsArray.length; i++)
{
document.write('