
/* Element ---------------------------*/
function element(id){
return document.getElementById(id);
}

/* Style Settings --------------------*/
function set_style(id, style){
set_style_obj(element(id), style);
}
function set_style_obj(o, style){
o.className = style;
}

/* Image Swapper ---------------------*/
function swap_lowsrc(id){ //Image Swop SRC With LowSRC
swap_lowsrc_img(element(id));
}
function swap_lowsrc_img(img){ //Image Swop SRC With LowSRC
var src = img.src;
img.src = img.lowsrc;
img.lowsrc = src;
}


/* HTML XChange */
function secure_setHTML(id, html_code){
if(element(id) != null)
element(id).innerHTML = html_code;
}

function do_dots(text, type) {

var length = {};
length['thumb'] = 22;

if(text.length > length[type])
return text.substring(0, length[type] - 3) + '...';

return text;
}
//* Browser Compatibility
//* Copyright 2006 OPAG Online Promotion AG
if(!Array.indexOf) {
Array.prototype.indexOf = function(searchElement, fromIndex) {
fromIndex = fromIndex || 0;
for(var i = fromIndex; i < this.length; ++i) {
if(this[i] === searchElement)
return i;
}
return -1;
}
}
var _site_countryflag_onclick = null;
var _site_countryflag_block = false;
function toggle_countries() {
var n = document.getElementById('site_countries');
if(n.style.display == 'none')
show_countries();
else
hide_countries();
}
function show_countries() {
var img = document.getElementById('site_countryflag');
var width = 0;
if(document.documentElement && document.documentElement.offsetWidth && document.documentElement.offsetWidth > 0)
width = document.documentElement.offsetWidth;
else
width = document.body.offsetWidth;
var left = img.offsetLeft;
while((img = img.offsetParent) != null)
left += img.offsetLeft;
var list = document.getElementById('site_countries');
if(left > 300)
list.style.right = (width - left) + 'px';
else
list.style.left = left + 'px';
list.style.top = '45px';
list.style.display = '';
list.onmouseover = function() {
_site_countryflag_block = true;
}
list.onmouseout = function() {
_site_countryflag_block = false;
}
if(typeof(document.body.onclick) == 'function')
_site_countryflag_onclick = document.body.onclick;
_site_countryflag_block = true;
document.body.onclick = function(e) {
if(_site_countryflag_block == true)
return;
hide_countries();
if(_site_countryflag_onclick != null)
_site_countryflag_onclick(e);
}
setTimeout(function() { _site_countryflag_block = false; }, 1000);
}
function hide_countries() {
document.getElementById('site_countries').style.display = 'none';
if(_site_countryflag_onclick != null)
document.body.onclick = _site_countryflag_onclick;
_site_countryflag_onclick = null;
_site_countryflag_block = false;
}

