﻿var coexternalFile = 0;
var currect_file = false;
var back_file = false;
var reqid = randomXToY('0','1000000');
function randomXToY(minVal,maxVal,floatVal)
{
  var randVal = minVal+(Math.random()*(maxVal-minVal));
  return typeof floatVal=='undefined'?Math.round(randVal):randVal.toFixed(floatVal);
}
function prepare_content_page(e,id,loadtimeout,link,url,usejs,jsFile){
back_file = currect_file;
if(link == 'array'){
var links = new Array();

		links[1] = 'home.php';
		links[2] = 'about.php';
		links[3] = 'music.php';
		links[4] = 'gal_home.php';
		links[5] = 'forum.php';
		links[6] = 'home.php?poll=ok';
		links[7] = 'users/myaccount.php';
if(links[id].search(/\?/) == -1){
midle = '?rq=';
} else {
midle = '&rq=';
}
coexternalFile = links[id]+midle+reqid;
currect_file = links[id];
set_ext_link(links[id]);
} else if (link == 'url'){

if(url.search(/\?/) == -1){
midle = '?rq=';
} else {
midle = '&rq=';
}
coexternalFile = url+midle+reqid;
currect_file = url
set_ext_link(url);
}
document.getElementById('content_object').innerHTML = "<img src='images/loader_1.gif'>";
if(e==1 && loadtimeout != "undefined" && loadtimeout != false){
setTimeout("start_content();", loadtimeout);
} else {
start_content();
}
reqid++
}

function start_content(){
$.get(coexternalFile,
  function(data){
    document.getElementById('content_object').innerHTML = data;
  });
}

function set_ext_link(file){
	if(file.search(/\&/) == -1){
	fileex = file;
	} else {
	fileex = file.replace("&", "^");
	}
	document.getElementById('share_href').value = "http://hardstyle.lv/?OL=true&&openFile="+fileex;
}