function checkformx(theForm){
    var msg='';

    if((theForm.email.value=='blank')||(theForm.email.value=='')){
            msg='Wrong email address!'
            theForm.email.focus();
    }else
    if((theForm.email.value.indexOf('@')<1)||
    (theForm.email.value.indexOf('@')>(theForm.email.value.length - 5))||
    (theForm.email.value.indexOf('.')<1)){
            msg='Wrong email address!'
            theForm.email.focus();
    }else
    if((theForm.domain.value=='blank')||(theForm.domain.value=='')){
            msg='Wrong domain address!'
            theForm.domain.focus();
    }else
    if((theForm.title.value=='blank')||(theForm.title.value=='')){
            msg='Wrong title!'
            theForm.title.focus();
    }

    if(msg!=''){
            alert(msg);
            return false
    }else{
            return true;

    }
}

function checkform(theForm){
    var msg='';

    if((theForm.name.value=='blank')||(theForm.name.value=='')){
            msg='Wrong name!'
            theForm.name.focus();
    }else
    if((theForm.email.value=='blank')||(theForm.email.value=='')){
            msg='Wrong email address!'
            theForm.email.focus();
    }else
    if((theForm.email.value.indexOf('@')<1)||
    (theForm.email.value.indexOf('@')>(theForm.email.value.length - 5))||
    (theForm.email.value.indexOf('.')<1)){
            msg='Wrong email address!'
            theForm.email.focus();
    }
    

    if(msg!=''){
            alert(msg);
            return false
    }else{
            return true;

    }
}

function add_favorites()
{
	var varsite='http://www.ffonts.net';
	var vardesc='Free Fonts Download - www.ffonts.net';
	var detect = navigator.userAgent.toLowerCase();
	//alert(detect);
	if(detect.indexOf('opera') + 1) alert("After you close this dialog please press CTRL+T to add to Favorites");
	else if(detect.indexOf('msie') + 1) window.external.AddFavorite(varsite,vardesc);
	else if(detect.indexOf('firefox') + 1) alert("After you close this dialog please press CTRL+D to add to Favorites");
	else if(detect.indexOf('netscape') + 1) alert("After you close this dialog please press CTRL+D to add to Favorites");
	else alert("Please use your browser's menu to add to Favorites");
}
function validate()
{
if( !document.searchform.searchtext.value || document.searchform.searchtext.value.length < 3) {
            document.searchform.searchtext.focus();
            alert('Search term too short, please try again');
            return false;
 }
}

function OpenWindow(page,name,w,h,scroll)
{
setari = 'height='+h+',width='+w+',scrollbars='+scroll+',resizable';
win = window.open('/brokenlink'+page,name,setari);
}

function OpenWindow1(page,name,w,h,scroll)
{
setari = 'height='+h+',width='+w+',scrollbars='+scroll+',resizable';
win = window.open(page,name,setari);
}

function verifyFormSubscribe(theForm){
    var msg='';

    if((theForm.input_email.value=='blank')||(theForm.input_email.value=='')){
            msg='Wrong email address!'
            theForm.input_email.focus();
    }else
    if((theForm.input_email.value.indexOf('@')<1)||
    (theForm.input_email.value.indexOf('@')>(theForm.input_email.value.length - 5))||
    (theForm.input_email.value.indexOf('.')<1)){
            msg='Wrong email address!'
            theForm.input_email.focus();
    }

    if(msg!=''){
            alert(msg);
            return false
    }else{
            return true;

    }
}

function showhide(divid){
document.getElementById(divid).style.display = (document.getElementById(divid).style.display=='none')?'':'none';
}

function saveads(id,rr)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return;
} 

var url="/index.php?p=addwishlist&id="+id
url=url+"&action="+rr
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged ;	
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
return;
} 

function stateChanged() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
valoare1=xmlHttp.responseText;
document.getElementById('saveadid').innerHTML ='<div class="fontbox"><div id="info1">'+valoare1+'</div><img src="/images/fontboxbottom.gif" width="734" height="7" alt=""  /></div>';
var show = document.getElementById("saveadid");
var showStyle = show.style;
showStyle.display = "";
} 
} 


function refresh(id,text1)
{


var url="index.php?p=refresh&id="+id
url=url+"&text="+text1
//url=url+"&sid="+Math.random()


document.getElementById('imgidnew').setAttribute('width',730);
document.getElementById('imgidnew').setAttribute('height',200);
document.getElementById('imgidnew').setAttribute('src',url);
//alert(1);
//return;
} 


function refreshx(id,text1)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return;
} 

var url="index.php?p=refreshxx&id="+id
url=url+"&text="+text1
//url=url+"&sid="+Math.random()

xmlHttp.onreadystatechange=stateChangedxx ;	
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
return;

} 

function stateChangedxx() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
alert(xmlHttp.responseText);
} 
} 


function GetXmlHttpObject()
{ 
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
} 


var xmlHttp
var innerstr;
var pagsunt;
var idto;

function stateChangeds() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
document.getElementById('voturiid').innerHTML=xmlHttp.responseText ;
} 
}


function faddmail(id)
{
if(trim(document.getElementById('comformail').numeid.value)==''){
alert('The Name field was left blank!'); 
return false;
}
if(trim(document.getElementById('comformail').emailid.value)==''){
alert('The Email Address you entered appears to be invalid!'); 
return false;
}
if(trim(document.getElementById('comformail').emailpid.value)==''){
alert('The Friend Email Address you entered appears to be invalid!'); 
return false;
}
if(trim(document.getElementById('comformail').spamid.value)==''){
alert('Please enter anti spam number!'); 
return false;
}
if(trim(document.getElementById('comformail').mesajid.value)==''){
alert('Please enter a message!'); 
return false;
}
pagsunt='casutamail';
pagsunt1='comentariim';
	if (id>0){
	
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	{
	alert('Error');
	return false;
	} 
	var url="/index.php"
	url=url+"?p=trimite&id="+id
	url=url+"&nume="+addSlashes(document.getElementById('comformail').numeid.value)
	url=url+"&email="+addSlashes(document.getElementById('comformail').emailid.value)
	url=url+"&emailp="+addSlashes(document.getElementById('comformail').emailpid.value)		
	url=url+"&spam="+addSlashes(document.getElementById('comformail').spamid.value)		
	url=url+"&mesaj="+addSlashes(document.getElementById('comformail').mesajid.value)
	url=url+"&sid="+Math.random()
	xmlHttp.onreadystatechange=stateChangedr ;
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
	}
}

function hideinfo(){
	document.getElementById('comformail').numeid.value='';
	document.getElementById('comformail').emailid.value='';
	document.getElementById('comformail').emailpid.value='';	
	document.getElementById('comformail').spamid.value='';
	document.getElementById('comformail').mesajid.value='';	
}

function stateChangedr() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{ 
document.getElementById(pagsunt1).innerHTML=xmlHttp.responseText ;
if (xmlHttp.responseText.match(/OK/)){
hideinfo();
}
}
}


function trim(var1){
	var re1 = /\s*((\S+\s*)*)/;
	var re2 = /((\s*\S+)*)\s*/;
	return var1.replace(re1, "$1").replace(re2, "$2");
}

function addSlashes(var1){
	var re = /('|")/g;
	return var1.replace(/\n/ig,' ').replace(re,"\\"+"$1");
	
}

function resettext(var1){
	var1=var1.replace(/(<([^>]+)>)/ig,'');
	return var1;
	
}




