function doit()
{
	var hor='<iframe frameborder=0 src="/banner-1.html" scrolling="no"></iframe>';
	document.getElementById("bannertop").innerHTML=hor;
        document.getElementById("banner_bottom").innerHTML=hor;

        if(typeof(bid)=='undefined'){
                url = '2.html';
        }  else {
		url = '.html?i=' + bid;
		if(typeof(burl)=='undefined'){
			url = 'c1' + url + '&s=' + bs;
		} else {
			url = 'c2' + url + '&u=' + escape(burl) + '&t=' + bext;
		}
        }

	var ban2 = document.getElementById("banner");
	ban2.innerHTML='<iframe frameborder=0 src="/banner-' + url + '" scrolling="no"></iframe>';

        var fb='<a href="https://plus.google.com/106723454435040593780" style="text-decoration:none;float:left;margin-right:5px;" target="_blank"><img src="https://ssl.gstatic.com/images/icons/gplus-32.png" alt="" style="border:0;width:20px;height:20px;"/></a><g:plusone size="medium" annotation="bubble" href="https://plus.google.com/106723454435040593780" ></g:plusone><div class="fb-like" style="top:-2px" data-href="http://www.facebook.com/fonts2u" data-send="false" data-layout="button_count" data-width="100" data-show-faces="false"></div>';
	var cimp='<fb:comments href="'+window.location.href.split("?")[0]+'" numpost="10"></fb:comments>';

        document.getElementById("fbook").innerHTML=fb;
	document.getElementById("chin").innerHTML='<iframe src="http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Ffonts2u&amp;width=515&amp;colorscheme=light&amp;connections=9&amp;stream=false&amp;header=false&amp;height=180&amp" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:515px; height:156px;border-bottom:1px solid #acacac;margin:5px 0 20px 10px;" allowTransparency="true"></iframe><span style="float:left;margin:5px 35px 0 10px"><g:plus href="https://plus.google.com/106723454435040593780" size="badge"></g:plus></span>';
	document.getElementById("cimp").innerHTML=cimp;
}
 
if(document.addEventListener) {
    document.addEventListener("DOMContentLoaded", function()
    {
        document.removeEventListener( "DOMContentLoaded", arguments.callee, false);
        doit();
    }, false);
}
else if(document.attachEvent) {
    document.attachEvent("onreadystatechange", function()
    {
        if(document.readyState === "complete") {
            document.detachEvent("onreadystatechange", arguments.callee);
            doit();
        }
    });
}

window.onscroll=doOnScroll;
window.onload=doOnLoad;

function doOnLoad() {
db=document.getElementsByTagName('button');
for(c=0;c<db.length;c++){
db[c].onclick=function(){var da = this.value.split('|||');url='http://'+location.hostname+'/donation.html?e='+escape(da[0])+'&d='+da[1];window.open(url);}
}}

function ml(){
	var m=document.getElementById("mirror");
	var c=document.getElementById("menu").cloneNode(true);
	c.className='menulow';
	m.insertBefore(c,m[1]);
}

function doOnScroll() {
        var banner = document.getElementById("banner");
        var offset = document.getElementById("chold").offsetTop;

          if(typeof(window.pageYOffset)=="number") {
            x = window.pageYOffset - offset;y = 0;
          } else if(document.body && (document.body.scrollLeft || document.body.scrollTop)) {
            x = document.body.scrollTop - offset; y = 0;
          } else if(document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) {
            x = document.documentElement.scrollTop - offset;y = 0;
          }

        if (x>0) {
                if (document.body.clientHeight>999+y+x) banner.style.top = offset+y+x+"px";
        } else {
                banner.style.top=offset+y+"px";
        }
}

function c(){window.location='#comments';}
function over(star,total,id){var a=document.getElementById('r'+id).getElementsByTagName('a');for(x=1;x<=6;x++){var c='';if(x<=star){c=2;}else if(x<=total){c=1;}
a[x-1].style.background="transparent url('http://www.fonts2u.com/images/_star"+c+".gif') no-repeat top right";}}
function out(id,total){var a=document.getElementById('r'+id).getElementsByTagName('a');for(x=1;x<=6;x++){if(x<=total){c=1;}else{c='';}
a[x-1].style.background="transparent url('http://www.fonts2u.com/images/_star"+c+".gif') no-repeat top right";}}
function checker(current){var inp=current.getElementsByTagName('input');var tda=current.getElementsByTagName('td');if(inp[0].checked==false){inp[0].checked=true
tda[1].style.color="#00a5ff"}else{inp[0].checked=false
tda[1].style.color="black"}}
function im(code,page){var select=document.getElementById("charmap");var charmap=select.value;ok=code.replace(new RegExp("-","g"),"");var url=window.location.protocol+'//i.fonts2u.com/'+ok.substring(0,2)+'/mp'+charmap+'_'+code+'_'+page+'.png';for(var i=0;i<select.options.length;i++){if(select.options[i].selected==true){var selname=select.options[i].text;newstr=selname.replace(/(\.*)\s*\(\w*\)/,"$1");dig=selname.replace(/.*\s*(\()(\w*)(\))/,"$2");break}}
if(dig/150>1){var total=Math.ceil(dig/150);var inner=prev=next='';var devider='<span>|</span>';var n=1;start=(Math.floor((page-1)/10)*10)+1;end=Math.ceil(page/10)*10;if(end<total){next='<li><a href="javascript:im(\''+code+'\',\''+(end+1)+'\')">>></a></li>';}
if(page>10){prev='<li><a href="javascript:im(\''+code+'\',\''+(start-1)+'\')"><<</a></li>';}
if(start+9<total){total=end;}
for(x=start;x<=total;x++){if(x>1)devider='';inner+='<li>'+devider+'<a href="javascript:pm(\''+code+'\',\''+charmap+'\',\''+x+'\')">'+x+'</a></li>';}
document.getElementById('pagersel').innerHTML='<ul>'+prev+inner+next+'</ul>';var children=document.getElementById('pagersel').getElementsByTagName('a');if(page>10){page=page-Math.floor(page/10)*10+1;if(page==1)page=11;}
children[page-1].style.fontWeight='bold';children[page-1].style.textDecoration='underline';document.getElementById('pagerright').style.visibility='visible';}else{document.getElementById('pagersel').innerHTML='';document.getElementById('pagerright').style.visibility='hidden';}
document.getElementById('map').innerHTML=newstr;var container=document.getElementById("charmap-placeholder");while(container.firstChild)container.removeChild(container.firstChild);var sp=document.createElement('SPAN');sp.innerHTML=lang();container.appendChild(sp);var img=document.createElement("IMG");img.onload=function(){while(container.firstChild)container.removeChild(container.firstChild);container.appendChild(this);}
img.src=url;}
function xt(){document.getElementById('filterxt').style.display='block';document.getElementById('xt').style.display='none';}
function s(){var size=document.getElementById('size').value;var custom=document.getElementById('ct').value;var divs=document.getElementsByTagName('div');for(i=0;i<divs.length;i++){if((divs[i].className=='ppane')||(divs[i].className=='ppane large')||(divs[i].className=='ppane extreme')){if(size==3){divs[i].className='ppane large';}else if(size==4){divs[i].className='ppane extreme';}else{divs[i].className='ppane';}}
if((divs[i].className=='im')||(divs[i].className=='im tiny')||(divs[i].className=='im small')||(divs[i].className=='im large')||(divs[i].className=='im extreme')){var link=divs[i].getElementsByTagName('a');if(size==3){link[1].className='large';}else if(size==4){link[1].className='extreme';}else{link[1].className='';}
var getbackground=divs[i].style.backgroundImage;var count=0;for(var a=0;a<getbackground.length;a++){if(getbackground[a]=='_')count++;}
if(count>1){newstr=getbackground.replace(/(\.*)_?\d?\.png\)/,'');}else{newstr=getbackground.replace(/(\.*)\.png\)/,'');}
var url=new String(document.location.href);url=url.replace(/http:\/\//,'');var urlparts=url.split("/");var host=urlparts[0];var splitid=divs[i].id.split('_');var currentid=splitid[1];var currentimage=splitid[0];if(custom!=''){if(size!=''){size2='&size='+size;}else{size2='';}
divs[i].style.backgroundImage='url(http://'+host+'/generate.html?id='+currentid+'&custom='+encodeURIComponent(custom)+size2+')';}else{var found=divs[i].style.backgroundImage.indexOf('generate.html');ok=currentimage.replace(new RegExp("-","g"),"");if(size!=''){divs[i].style.backgroundImage='url(http://'+host+'/'+ok.substring(0,2)+'/'+currentimage+'_'+size+'.png)';}else{divs[i].style.backgroundImage='url(http://'+host+'/'+ok.substring(0,2)+'/'+currentimage+'.png)';}}
if(size==1){divs[i].className='im tiny';}else if(size==2){divs[i].className='im small';}else if(size==3){divs[i].className='im large';}else if(size==4){divs[i].className='im extreme';}else{divs[i].className='im';}}}}
function pm(code,charmap,page){var children=document.getElementById('pagersel').getElementsByTagName('a');for(var c=0;c<children.length;c++){if(children[c].style){children[c].style.fontWeight='normal';children[c].style.textDecoration='none';}}
pg=page;if(page>10){pg=page-Math.floor(page/10)*10+1;if(pg==1)pg=11;}
children[pg-1].style.fontWeight='bold';children[pg-1].style.textDecoration='underline';ok=code.replace(new RegExp("-","g"),"");var url=window.location.protocol+'//i.fonts2u.com/'+ok.substring(0,2)+'/mp'+charmap+'_'+code+'_'+page+'.png';var container=document.getElementById("charmap-placeholder");while(container.firstChild)container.removeChild(container.firstChild);var sp=document.createElement('SPAN');sp.innerHTML=lang();container.appendChild(sp);var img=document.createElement("IMG");img.onload=function(){while(container.firstChild)container.removeChild(container.firstChild);container.appendChild(this);}
img.src=url;}
function cp(product,page){var url=window.location.protocol+"//"+window.location.host+'/'+'commentsget.html?p='+product+'&pg='+page;var con=createRequest();var container=document.getElementById("comments-container");con.onreadystatechange=function()
{if(con.readyState==4&&con.status==200)
{var response=con.responseText;var parts=response.split('|||||');switchmenu(product,page,parts[0],parts[1]);container.innerHTML=parts[2];}}
con.open("GET",url,true);if(typeof dt!=="undefined"){con.setRequestHeader('Cookie','s000aec242e65c8f7='+dt);}
con.send(null);}
function switchmenu(product,page,total,pages){if(total>1){var inner='';var devider='<span>|</span>';if(pages>1){for(x=1;x<=pages;x++){if(x>1)devider='';if(x==page){inner+='<li>'+devider+'<span class="pageselected">'+x+'</span></li>';}else{inner+='<li>'+devider+'<a href="javascript:cp(\''+product+'\',\''+x+'\')">'+x+'</a></li>';}}
document.getElementById('pagersel2').innerHTML='<ul>'+inner+'</ul>';document.getElementById('pagerright2').style.visibility='visible';}
document.getElementById('ctotal').innerHTML='('+total+')';}else{document.getElementById('ctotal').style.visibility='hidden';document.getElementById('pagersel2').innerHTML='';document.getElementById('pagerright2').style.visibility='hidden';}}
function sub(product){var message=document.getElementById('comment');if(message.value.length>0){var url=window.location.protocol+"//"+window.location.host+'/'+'commentspost.htm';var params='p='+product+'&comment='+message.value;var con=createRequest();con.onreadystatechange=function()
{if(con.readyState==4&&con.status==200)
{var response=con.responseText;if(response!=''){document.getElementById('notice').style.display='none';document.getElementById('notice2').innerHTML=response;document.getElementById('notice2').style.display='block';setTimeout("document.getElementById('notice2').style.display = 'none'",5000);}else{cp(product,1);message.value='';document.getElementById('notice').style.display='none';}}
if(con.readyState==1)
{document.getElementById('notice').style.display='block';}}
con.open("POST",url,true);con.setRequestHeader("Content-type","application/x-www-form-urlencoded;charset=UTF-8;");if(typeof dt!=="undefined"){con.setRequestHeader('Cookie','s000aec242e65c8f7='+dt);}
var IE6=false;if(IE6==false)
{con.setRequestHeader("Content-Length",params.length);con.setRequestHeader("Connection","close");}
con.send(params);}}
function rate(r,i){var url=window.location.protocol+"//"+window.location.host+'/'+'rateget.html?p='+i+'&r='+r;var ni=document.getElementById('page');var ex=document.getElementById('css_dialog');dimx=500;dimy=150;posY=getScreenCenterY()-(dimy/2);posX=getScreenCenterX()-(dimx/2);if(ex==null){var con=createRequest();con.onreadystatechange=function()
{if(con.readyState==1)
{if(ex==null){ex=document.createElement('div');ex.setAttribute('id',"css_dialog");ex.style.cssText="position:absolute;width:"+dimx+"px;top:"+posY+"px;left:"+posX+"px;border: 5px solid rgba(0, 0, 0, .3);";}
ex.innerHTML="<div><img src=\"../images/arrows.gif\" width=\"32\" height=\"32\" /></div>";ni.appendChild(ex);}
if(con.readyState==4&&con.status==200)
{ex.innerHTML="<div>"+con.responseText+"</div>";setTimeout("getout();",2500);}}
con.open("GET",url,true);if(typeof dt!=="undefined"){con.setRequestHeader('Cookie','s000aec242e65c8f7='+dt);}
con.send(null);}}
function getout(){var ex=document.getElementById('css_dialog');if(ex){var ni=document.getElementById('page');ni.removeChild(ex);}}
function createRequest()
{var xmlhttp=false;try{xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(E){xmlhttp=false;}}
if(!xmlhttp&&typeof XMLHttpRequest!='undefined'){try{xmlhttp=new XMLHttpRequest();}catch(e){xmlhttp=false;}}
if(!xmlhttp&&window.createRequest){try{xmlhttp=window.createRequest();}catch(e){xmlhttp=false;}}
return xmlhttp;}
function getScreenCenterY(){var y=0;y=getScrollOffset()+(getInnerHeight()/2);return(y);}
function getScreenCenterX(){return(document.body.clientWidth/2);}
function getInnerHeight(){var y;if(self.innerHeight)
{y=self.innerHeight;}
else if(document.documentElement&&document.documentElement.clientHeight)
{y=document.documentElement.clientHeight;}
else if(document.body)
{y=document.body.clientHeight;}
return(y);}
function getScrollOffset(){var y;if(self.pageYOffset)
{y=self.pageYOffset;}
else if(document.documentElement&&document.documentElement.scrollTop)
{y=document.documentElement.scrollTop;}
else if(document.body)
{y=document.body.scrollTop;}
return(y);}
function lang(){var metaTags=document.getElementsByTagName("meta");var lang=metaTags[1].getAttribute('content');var out;switch(lang){case'de-DE':out='Wird geladen ...';break;case'fr-FR':out='Chargement en cours ...';break;case'es-ES':out='Carga en curso ...';break;case'pt-PT':out='Carregando ...';break;case'it-IT':out='Caricamento in corso ...';break;case'pl-PL':out='Trwa ładowanie ...';break;case'cs-CZ':out='Nahrávám ...';break;case'sk-SK':out='Nahrávam ...';break;case'ru-RU':out='Загрузка ...';break;case'ua-UA':out='Триває завантаження ...';break;case'ja-JA':out='読み込んでいます...';break;case'zh-CN':out='载入中 ...';break;case'ar-AE':out='تحميل ...';break;default:out='Loading ...';}
return(out);}

