///(c) IAM, LIPFEED.COM 2010, ALL RIGHTS RESERVED
///(c) IAM, LIPFEED.COM 2010, ALL RIGHTS RESERVED
///(c) IAM, LIPFEED.COM 2010, ALL RIGHTS RESERVED
///(c) IAM, LIPFEED.COM 2010, ALL RIGHTS RESERVED


function changetype(obj){
var passwo=document.createElement('input');
passwo.setAttribute('type','password');
passwo.setAttribute('size','9');
passwo.setAttribute('name',obj.getAttribute('name'));
passwo.style.fontSize = "80%";
obj.parentNode.replaceChild(passwo,obj);
passwo.select();
}

function validatemes(txtcheck,maxLength){if(txtcheck.value.length > maxLength){txtcheck.value = txtcheck.value.substr(0,maxLength);}}



function bookmarklipfeed(url){
var title = document.title;

   if (document.all)
     window.external.AddFavorite(url, title);
   else if (window.sidebar)
     window.sidebar.addPanel(title, url, "")
   else if (window.sidebar&&window.sidebar.addPanel)
     window.sidebar.addPanel(title,url,"");
}

function createelem(elem,par,ide,classe,heighte){

var objparent = document.getElementById(par);


var newdiv = document.createElement(elem);
   newdiv.setAttribute('id', ide);

if(classe){
     newdiv.setAttribute('class', classe);
}

if(heighte){
     newdiv.style.height=heighte;
}

     newdiv.style.visibility="visible";
     objparent.appendChild(newdiv);

}



function ucfirst(str) {
    var firstLetter = str.substr(0, 1);
    return firstLetter.toUpperCase() + str.substr(1);
}


function loadheader(){


document.getElementById('usercontrolpanel2').innerHTML = '<a href="" id="bookmarklink" onclick="return false;" ><img id="famousizeimage" src="/images/famousize.png" title="FamousizeŠ yourself on Lipfeed.com" alt="FamousizeŠ yourself on Lipfeed.com"/>Famousize Yourself on Lipfeed.com "live" INTNET.TV&copy; The new universal entertainment advertising entity for Corporate and Individual clientele&copy;</a>';

}



function loadfooter(){



document.getElementById('footer').innerHTML= '<div  id="footercontent" onselectstart="return false" ><font style="margin-left:1%;margin-right:1%;position: relative; float: right;font-size: 80%; font-family: tahoma;color: black;">&nbsp;&copy; Lipfeed.com 2010</font><font onmouseout="this.style.color=\'black\';" onmouseover="this.style.color=\'red\';" onclick="terms(\'/tools/advertisingsalescontract.php\');return false;" href="" id="footerelement" style="">&nbsp;Advertising Sales Contract&nbsp;</font><font onmouseout="this.style.color=\'black\';" onmouseover="this.style.color=\'red\';" onclick="terms(\'/tools/terms.php\');return false;" href="" id="footerelement" style="">&nbsp;Terms&nbsp;</font><a onmouseout="this.style.color=\'black\';" onmouseover="this.style.color=\'red\';" onclick="window.location=\'/tools/user.php?u=lipfeed&type=contact\';return false;" href="/tools/user.php?u=lipfeed&type=contact" id="footerelement"style="">&nbsp;Contact&nbsp;</a><font onmouseout="this.style.color=\'black\';" onmouseover="this.style.color=\'red\';" id="footerelement" style=""  onclick="window.location=\'/tools/sp.php?logout=logout\'; return false;">&nbsp;Exit&nbsp;</font>&nbsp;</div>';
}

function loadsearch(){

document.getElementById('searchbox').innerHTML=  '<b><input type="text" style="font-size: 80%; width:30%;border: 1px grey solid" id="searchquery"><font id="shareboxsubmit" style="background-color:yellow;" onmouseout="this.style.color=\'black\';" onmouseover="this.style.color=\'red\';" onclick="search();">&nbsp;SEARCH LIPFEED.COM&nbsp;</font> </b>';


}

function loadadvert(username){

document.getElementById('advertcontrolpanel').innerHTML= '&nbsp;<a id="advertcontrolpanelinfo"  href="http://www.lipfeed.com/'+username+'" >&nbsp; '+ucfirst(username)+' Space. &nbsp;</a>&nbsp;&nbsp;&nbsp;'+
'<font id="advertcontrolpanelsubmit" onmouseout="this.style.color=\'black\';" href="" onclick="messagebox();" onmouseover="this.style.color=\'red\';">&nbsp;CONTACT&nbsp;</font>&nbsp;'+
'<font id="advertcontrolpanelsubmit" onmouseout="this.style.color=\'black\';" onmouseover="this.style.color=\'red\';"  onclick="sharebox();">&nbsp;SHARE&nbsp;</font>&nbsp;'+
'<a id="advertcontrolpanelsubmit"  onmouseout="this.style.color=\'black\';" onmouseover="this.style.color=\'red\';" href="http://www.lipfeed.com/tools/rss.php?user='+username+'" target="_blank">&nbsp;RSS FEED&nbsp;</a>&nbsp;';
}


function loadmessage(username){
document.getElementById('messagebox').innerHTML= '<br> <br><font style="cusor:pointer;font-weight:bold; background-color:darkblue;font-size:90%" >&nbsp;Contact&nbsp;'+username+':&nbsp;</font><br>'+
'<textarea id="composetext" style="font-family: tahoma; font-weight: lighter;font-size: 95%;width:90%;"  onchange="validatemes(this,148);" onkeydown="validatemes(this,148);" onkeyup="validatemes(this,148);" name="message" rows="2" cols="60"></textarea><br>'+
'<font id="messageboxsubmit" onmouseout="this.style.color=\'black\';" onmouseover="this.style.color=\'red\';"  onclick="postmessage(\'messagebox\', \''+username+'\' );">&nbsp;SEND MESSAGE&nbsp;</font>&nbsp;'+
'<font id="messageboxclose" onmouseout="this.style.color=\'black\';" onmouseover="this.style.color=\'red\';"   onclick="messagebox();">&nbsp;CLOSE&nbsp;</font>'+
'<br><font id="messageboxinfo" ></font><br><br>';


}

function loadshare(username){
document.getElementById('sharebox').innerHTML= ' <br><br>  <font style="font-weight:bold; background-color:darkblue;font-size:90%" >&nbsp;Share This Advertisement:&nbsp;</font><br><br>'+
 
'<div style="width:100%;clear:both;margin-top:1%;">'+
' <font style="font-family: tahoma;float:left;font-weight: lighter;cursor:default;">'+ucfirst(username)+' Url:</font>'+
' <input id="usershareurl" style="width: 70%; float:right;" type="text" onclick="this.focus();this.select();" value="http://www.lipfeed.com/'+username+'" >'+
'</div>'+
'<div style="width:100%;clear:both;margin-top:1%;">'+

'<font style="cursor:default;float:left;font-family: tahoma;font-weight: lighter;">'+ucfirst(username)+' Rss Url:</font> '+
' <input id="userrssshareurl" type="text" style="width: 70%; float:right;"  onclick="this.focus();this.select();" value="http://www.lipfeed.com/'+username+'/rss" >'+
'</div>'+

'<div style="width:100%;clear:both;margin-top:1%;">'+
'<font style="cursor:default;float:left;font-family: tahoma;font-weight: lighter;">This Url:</font>'+
'<input id="advertshareurl" type="text"  style="width: 70%; float:right;" onclick="this.focus();this.select();" value="'+window.location+'" >'+
'</div>'+

'<div style="width:100%;clear:both;margin-top:1%;">'+
'<font style="cursor:default;font-family: tahoma;font-weight: lighter;float:left;">Send:</font>'+
'<input id="advertsemail" type="text"  style="width: 70%; float:right;" onclick="this.value=\'\'; this.style.color=\'black\';" value="Email Address" >'+
'</div>'+


'<div style="width:100%;clear:both;margin-top:1%;">'+
'<font id="shareboxclose"  style="margin-top:1%;clear:both;float:right;" onmouseout="this.style.color=\'black\';" onmouseover="this.style.color=\'red\';"  onclick="sharebox();">&nbsp;CLOSE&nbsp;</font>'+
'<font style="float:right;">&nbsp;</font>'+
'<font id="shareboxsubmit" style="margin-top:1%;float:right;" onmouseout="this.style.color=\'black\';" onmouseover="this.style.color=\'red\';" onclick="postlink(\'\');">&nbsp;SEND&nbsp;</font> '+
'<font id="shareboxinfo" style="float:left" ></font>'+
'</div> <br><br>';


}


function loaduser(username,logged){

document.getElementById('usercontrolpanel').innerHTML= '<font id ="usercontrolpanelelement" onmouseout="this.style.color=\'black\';" onmouseover="this.style.color=\'red\';"  onclick="window.location=\'http://www.lipfeed.com/tools/user.php?u='+username+'\'; return false;">&nbsp;'+ucfirst(username)+'&nbsp;</font>&nbsp;'+
'&nbsp;<font id ="usercontrolpanelelement"  onmouseout="this.style.color=\'black\';" onmouseover="this.style.color=\'red\';"  onclick="advertbox();">&nbsp;Create/Replace Ad&nbsp;</font>';

if(logged=="yes"){
document.getElementById('usercontrolpanel').innerHTML = document.getElementById('usercontrolpanel').innerHTML + '&nbsp;<font id="usercontrolpanelelement" onmouseout="this.style.color=\'black\';" onmouseover="this.style.color=\'red\';" onclick="window.location=\'http://www.lipfeed.com/tools/user.php?u='+username+'&type=publish\'; return false;">&nbsp;Front Page Display&nbsp;</font>&nbsp;';
}

if(logged=="yes"){
document.getElementById('usercontrolpanel').innerHTML = document.getElementById('usercontrolpanel').innerHTML + '<font id ="usercontrolpanelelement"  onmouseout="this.style.color=\'black\';" onmouseover="this.style.color=\'red\';" onclick="passwordbox();">&nbsp;Password&nbsp;</font>';

}

}
function ajaxload(){






createelem("div","half","freeflow");
createelem("div","freeflow","freeflowbox1");
createelem("a","freeflowbox1","freeflowboxlink1");
createelem("img","freeflowboxlink1","freeflowimage1" ,"freeflowimage");
createelem("div","freeflowbox1","freeflowheader");


createelem("div","freeflow","freeflowbox2");
createelem("a","freeflowbox2","freeflowboxlink2");
createelem("img","freeflowboxlink2","freeflowimage2", "freeflowimage");
createelem("div","freeflowbox2","freeflowheader");



createelem("div","freeflow","freeflowbox3");
createelem("a","freeflowbox3","freeflowboxlink3");
createelem("img","freeflowboxlink3","freeflowimage3", "freeflowimage");
createelem("div","freeflowbox3","freeflowheader");


createelem("div","freeflow","freeflowbox4");
createelem("a","freeflowbox4","freeflowboxlink4");
createelem("img","freeflowboxlink4","freeflowimage4", "freeflowimage");
createelem("div","freeflowbox4","freeflowheader");


createelem("div","freeflow","freeflowbox5");
createelem("a","freeflowbox5","freeflowboxlink5");
createelem("img","freeflowboxlink5","freeflowimage5", "freeflowimage");
createelem("div","freeflowbox5","freeflowheader");




createelem("div","half","featurescontainer");
createelem("div","featurescontainer","featurescontainer2");
createelem("div","featurescontainer2","featuresblock");
createelem("div","featuresblock","featuresblock2");
createelem("a","featuresblock2","featureslink");
createelem("img","featureslink","featuresimages" , "","90%");
createelem("div","featuresblock2","featurestitle");
createelem("div","featuresblock2","featuresusername");


document.getElementById('featurestitle').innerHTML = '<marquee style="cursor: pointer;width:95%;"> FEATURES  </marquee>';

createelem("div","half","freeflowb");


createelem("div","freeflowb","freeflowbox1b");
createelem("a","freeflowbox1b","freeflowboxlink1b");
createelem("img","freeflowboxlink1b","freeflowimage1b" ,"freeflowimage");
createelem("div","freeflowbox1b","freeflowheader");
//document.getElementById('freeflowheader').innerHTML = 'hello';

createelem("div","freeflowb","freeflowbox2b");
createelem("a","freeflowbox2b","freeflowboxlink2b");
createelem("img","freeflowboxlink2b","freeflowimage2b", "freeflowimage");
createelem("div","freeflowbox2b","freeflowheader");



createelem("div","freeflowb","freeflowbox3b");
createelem("a","freeflowbox3b","freeflowboxlink3b");
createelem("img","freeflowboxlink3b","freeflowimage3b", "freeflowimage");
createelem("div","freeflowbox3b","freeflowheader");


createelem("div","freeflowb","freeflowbox4b");
createelem("a","freeflowbox4b","freeflowboxlink4b");
createelem("img","freeflowboxlink4b","freeflowimage4b", "freeflowimage");
createelem("div","freeflowbox4b","freeflowheader");


createelem("div","freeflowb","freeflowbox5b");
createelem("a","freeflowbox5b","freeflowboxlink5b");
createelem("img","freeflowboxlink5b","freeflowimage5b", "freeflowimage");
createelem("div","freeflowbox5b","freeflowheader");


//STarframe


createelem("div","half2","starframecontainer");
createelem("div","starframecontainer","starframecontainer2");
createelem("div","starframecontainer2","starframeblock");
createelem("div","starframeblock","starframeblock2");
createelem("a","starframeblock2","starframelink");
createelem("img","starframelink","starframeimages" , "","90%");
createelem("div","starframeblock2","starframetitle");
createelem("div","starframeblock2","starframeusername");
document.getElementById('starframetitle').innerHTML = '<marquee style="cursor: pointer;width:95%;"> STARFRAME  </marquee>';


createelem("div","half2","showcasecontainer");

createelem("div","showcasecontainer","showcasecontainer2");
createelem("div","showcasecontainer2","showcaseblock");
createelem("div","showcaseblock","showcaseblock2");
createelem("a","showcaseblock2","showcaselink");
createelem("img","showcaselink","showcaseimages" , "","90%");
createelem("div","showcaseblock2","showcasetitle");
createelem("div","showcaseblock2","showcaseusername");
document.getElementById('showcasetitle').innerHTML = '<marquee style="cursor: pointer;width:95%;"> SHOWCASE  </marquee>';



createelem("div","showcasecontainer","showcasecontainer2b");
createelem("div","showcasecontainer2b","showcaseblockb");
createelem("div","showcaseblockb","showcaseblock2b");
createelem("a","showcaseblock2b","showcaselinkb");
createelem("img","showcaselinkb","showcaseimagesb" , "","90%");
createelem("div","showcaseblock2b","showcasetitleb");
createelem("div","showcaseblock2b","showcaseusernameb");
document.getElementById('showcasetitleb').innerHTML = '<marquee style="cursor: pointer;width:95%;"> SHOWCASE  </marquee>';



var mydivs = document.getElementsByTagName('div');
var divlen = mydivs.length;
for (var i=0;i<divlen;i++) {
if (mydivs[i].id=="freeflowheader"){
mydivs[i].innerHTML='<marquee style="cursor: pointer;width:95%;"> FREE FLOW  </marquee>';
}
}



setTimeout('ajax();',50);
}


function ajax(){

	var ajaxRequest;  // The variable that makes Ajax possible!
	
	try{
		// Opera 8.0+, Firefox, Safari
		ajaxRequest = new XMLHttpRequest();
	} catch (e){
		// Internet Explorer Browsers
		try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				// Something went wrong
				alert("Connection Lost");
				return false;
			}
		}
	}
	// Create a function that will receive data sent from the server
	ajaxRequest.onreadystatechange = function(){

            if(ajaxRequest.readyState == 1){
                      //objParent=document.getElementById('half');
			 //objParent.innerHTML= '<img src="/images/ajax.gif" >';
                      
		}

		if(ajaxRequest.readyState == 4){
                     
                 
                   eval(ajaxRequest.responseText);  

                    objParent=document.getElementById('half');
                       
                objParent.style.display = 'inline';
  
                  objParent=document.getElementById('half2');
                       
                objParent.style.display = 'inline';
  
                                  
		}
	}

timeset = Math.random();
///window.location.hash = timeset;
	ajaxRequest.open("GET", "ajax.php?"+"&t="+timeset, true);
	ajaxRequest.send(null); 

//setTimeout('ajax();', 10000);

}




function findmisswannabee(){ var sm = window.open ("/apps/treasurehunt.php?","treasurehunt","location=0,status=0,scrollbars=1,left=100,top=100,width=800,height=700"); advertise.focus();return false; }



function addborder(elem){ 
return true; 
elem.style.border='6px none #FF0000';
elem.style.width='85%';
elem.style.height='85%';
}

function removeborder(elem){
return true;
elem.style.border='0px solid ';
elem.style.width='95%';
elem.style.height='95%';
}



function loadimage(){
previewimg = document.getElementById("previewit");
previewimgsrc = document.getElementById("imgurl");
if(previewimgsrc.src!=null ){
previewimg.style.height='auto';previewimg.src=previewimgsrc.value; previewimg.style.visibility='visible'; previewimg.style.width='85%'; 
}else{
previewimg.style.height='0%';previewimg.src=previewimgsrc.value; previewimg.style.visibility='hidden'; previewimg.style.width='0%'; 
}
}

function loadimageit(thise){
document.getElementById("imgurl").value=thise.src;
}


function showpaywindow(){
var advertise = window.open ("/tills/pay.php?","paywindow","location=0,status=0,scrollbars=1,left=150,top=150,width=300,height=300"); 
advertise.focus();
return false;
}

function terms(link){
var terms = window.open (""+link+"","terms_window","location=0,status=0,scrollbars=1,left=150,top=150,width=800,height=500"); 
terms.focus();
return false;


}

function showpaypalwindow(amount,price){
//publishbox();
var link = "/tills/createpaypal.php?amount="+amount+"&price="+price;
var paypal = window.open (""+link+"","Paypal_window","location=0,status=0,scrollbars=1,left=100,top=150,width=900,height=500"); 
//paypal.style.width='100%';
//paypal.style.height='100%';

paypal.focus();
return false;
}


function showpaypalwindow2(amount,price,prom){
//publishbox();
var link = "/tills/createpaypal.php?amount="+amount+"&price="+price+"&prom="+prom;
var paypal = window.open (""+link+"","Paypal_window","location=0,status=0,scrollbars=1,left=100,top=150,width=900,height=500"); 
//paypal.style.width='100%';
//paypal.style.height='100%';

paypal.focus();
return false;
}






function advertbox(){
infoboxx = document.getElementById("advertbox"); 

if(infoboxx.style.visibility=="hidden"){
postadvert('', 'a');
infoboxx.style.visibility="visible";
infoboxx.style.position="relative";
infoboxx.style.height="auto";


infoboxx = document.getElementById("sendbox"); 
infoboxx.style.visibility="hidden";
infoboxx.style.position="absolute";
infoboxx.style.height="0%";



infoboxx = document.getElementById("passwordbox"); 
infoboxx.style.visibility="hidden";
infoboxx.style.position="absolute";
infoboxx.style.height="0%";

infoboxx = document.getElementById("theadvert"); 
infoboxx.style.display="none";


}else{
infoboxx.style.visibility="hidden";
infoboxx.style.position="absolute";
infoboxx.style.height="0%";
infoboxx.innerHTML="";
infoboxx = document.getElementById("theadvert"); 
infoboxx.style.display="";
}
}




function passwordbox(){
ajax();

infoboxx = document.getElementById("passwordbox"); 

if(infoboxx.style.visibility=="hidden"){
infoboxx.style.visibility="visible";
infoboxx.style.position="relative";
infoboxx.style.height="auto";
infoboxx = document.getElementById("sendbox"); 
infoboxx.style.visibility="hidden";
infoboxx.style.position="absolute";
infoboxx.style.height="0%";
infoboxx = document.getElementById("advertbox"); 
infoboxx.style.visibility="hidden";
infoboxx.style.position="absolute";
infoboxx.style.height="0%";
infoboxx.innerHTML="";

infoboxx = document.getElementById("theadvert"); 
infoboxx.style.display="none";

}else{
infoboxx.style.visibility="hidden";
infoboxx.style.position="absolute";
infoboxx.style.height="0%";
infoboxx = document.getElementById("theadvert"); 
infoboxx.style.display="";
}
}



function sendbox(){
ajax();
infoboxx = document.getElementById("sendbox"); 
if(infoboxx.style.visibility=="hidden"){
infoboxx.style.visibility="visible";
infoboxx.style.position="relative";
infoboxx.style.height="auto";
infoboxx = document.getElementById("passwordbox"); 
infoboxx.style.visibility="hidden";
infoboxx.style.position="absolute";
infoboxx.style.height="0%";
infoboxx = document.getElementById("advertbox"); 
infoboxx.style.visibility="hidden";
infoboxx.style.position="absolute";
infoboxx.style.height="0%";
infoboxx.innerHTML="";
infoboxx = document.getElementById("theadvert"); 
infoboxx.style.display="none";

}else{
infoboxx.style.visibility="hidden";
infoboxx.style.position="absolute";
infoboxx.style.height="0%";
infoboxx = document.getElementById("theadvert"); 
infoboxx.style.display="";
}
}


function sendboxsend(){
window.location = "http://www.lipfeed.com/"+document.getElementById("sendboxusername").value+"/contact/";
}


function sharebox(){


infoboxx = document.getElementById("sharebox"); 

if(infoboxx.style.visibility=="hidden"){
infoboxx.style.visibility="visible";
infoboxx.style.position="relative";
infoboxx.style.height="auto";
infoboxx = document.getElementById("messagebox"); 
infoboxx.style.visibility="hidden";
infoboxx.style.position="absolute";
infoboxx.style.height="0%";

//infoboxx = document.getElementById("theadvert"); 
//infoboxx.style.display="none";
}else{
infoboxx.style.visibility="hidden";
infoboxx.style.position="absolute";
infoboxx.style.height="0%";
//infoboxx = document.getElementById("theadvert"); 
//infoboxx.style.display="";
}
}





function setbox(){
infoboxx = document.getElementById("setbox"); 

if(infoboxx.style.visibility=="hidden"){
infoboxx.style.visibility="visible";
infoboxx.style.position="relative";
infoboxx.style.height="auto";
infoboxx = document.getElementById("messagebox"); 
infoboxx.style.visibility="hidden";
infoboxx.style.position="absolute";
infoboxx.style.height="0%";

infoboxx = document.getElementById("sharebox"); 
infoboxx.style.visibility="hidden";
infoboxx.style.position="absolute";
infoboxx.style.height="0%";



}else{
infoboxx.style.visibility="hidden";
infoboxx.style.position="absolute";
infoboxx.style.height="0%";
}
ajax();
}



function messagebox(){

infoboxx = document.getElementById("messagebox"); 

if(infoboxx.style.visibility=="hidden"){
infoboxx.style.visibility="visible";
infoboxx.style.position="relative";
infoboxx.style.height="auto";
infoboxx = document.getElementById("sharebox"); 
infoboxx.style.visibility="hidden";
infoboxx.style.position="absolute";
infoboxx.style.height="0%";



//infoboxx = document.getElementById("theadvert"); 
//infoboxx.style.display="none";


}else{
infoboxx.style.visibility="hidden";
infoboxx.style.position="absolute";
infoboxx.style.height="0%";
//infoboxx = document.getElementById("theadvert"); 
//infoboxx.style.display="";



}
}


function publishbox(){


infoboxx = document.getElementById("publish_box"); 

if(infoboxx.style.visibility=="hidden"){
infoboxx.style.visibility="visible";
infoboxx.style.position="relative";
infoboxx.style.height="auto";
infoboxx = document.getElementById("sharebox"); 
infoboxx.style.visibility="hidden";
infoboxx.style.position="absolute";
infoboxx.style.height="0%";
infoboxx = document.getElementById("messagebox"); 
infoboxx.style.visibility="hidden";
infoboxx.style.position="absolute";
infoboxx.style.height="0%"




}else{
infoboxx.style.visibility="hidden";
infoboxx.style.position="absolute";
infoboxx.style.height="0%";





}
ajax();
}









function search(){

ajax();
var ajaxRequest;
try{
ajaxRequest = new XMLHttpRequest();
} catch (e){
try{
			ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
			try{
				ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e){
				alert("Connection Lost");
				return false;
			}
		}
	}
	ajaxRequest.onreadystatechange = function(){
		if(ajaxRequest.readyState == 4){
                      objParent=document.getElementById('searchbox');
			 objParent.innerHTML= ''+ajaxRequest.responseText;
		}

       }

       if(document.getElementById('searchquery').value){
       searchvalue = document.getElementById('searchquery').value;  
       }else{
       return false;
       }
       objParent=document.getElementById('searchbox');
	objParent.innerHTML=  '<img src="/images/ajax.gif" > Searching...<br>';            
       searchvalue=searchvalue.replace(".", "+");
	ajaxRequest.open("GET", "/tools/searchfor.php?descrip="+escape(searchvalue), true);
	ajaxRequest.send(null); 
}


function savepassword(myform ){
      var params="password="+document.getElementById("password").value;
     var url="/tools/settings.php";
   var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', url, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {

        if (self.xmlHttpReq.readyState ==1 ) {
        document.getElementById('passwordboxsubmit').style.display="none";
            document.getElementById('passwordboxinfo').innerHTML = '<img src="/images/ajax.gif" ><br>';
        }
 
       
        if (self.xmlHttpReq.readyState == 4) {
            document.getElementById('passwordboxinfo').innerHTML = self.xmlHttpReq.responseText;
           var t=setTimeout("closepasswordalert()",5000);

        }
    }
    self.xmlHttpReq.send(params);
}






function closepasswordalert(elem){
document.getElementById('passwordboxinfo').innerHTML='';
document.getElementById('passwordboxsubmit').style.display="inline";
}



function postmessage(myform , user){

      var params="message="+document.getElementById("composetext").value+"&user="+user;
     var url="/tools/compose.php";
document.getElementById("composetext").value = '';
   var xmlHttpReq = false;
    var self = this;
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', url, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {

        if (self.xmlHttpReq.readyState ==1 ) {
             document.getElementById(myform+'submit').innerHTML = '';
            document.getElementById(myform+'info').innerHTML = '<img src="/images/ajax.gif" >';
        }
 
        if (self.xmlHttpReq.readyState == 4) {
            document.getElementById(myform+'info').innerHTML = self.xmlHttpReq.responseText;
           var t=setTimeout("closemessagealert()",5000);

        }
    }
    self.xmlHttpReq.send(params);
}






function closemessagealert(elem){
document.getElementById('messageboxinfo').innerHTML='';
document.getElementById('messageboxsubmit').innerHTML = '&nbsp;SEND MESSAGE&nbsp;';
}


function removeNL(s) {
  r = "";
  for (i=0; i < s.length; i++) {
    if (s.charAt(i) != '\n' &&
        s.charAt(i) != '\r' &&
        s.charAt(i) != '\t') {
      r += s.charAt(i);
      }
    }
  return r;
  }



function postadvert(myform , type){
if(type=="b"){ 

var params="link="+escape(document.getElementById("link").value)+"&descrip="+ escape(document.getElementById("descrip").value)+"&url="+ escape(document.getElementById("imgurl").value)+"&embedcode="+ escape(document.getElementById("embedcode").value);
document.getElementById('advertboxstatus').innerHTML = "&nbsp;<img src=\"/images/ajax.gif\">&nbsp;";


}

if(type=="c"){ 
scroll(0,0);

var params="link="+escape(document.getElementById("link").value)+"&descrip="+ escape(document.getElementById("descrip").value)+"&url="+ escape(document.getElementById("imgurl").value)+"&embedcode="+ escape(document.getElementById("embedcode").value)+"&captcha="+ escape(document.getElementById("captcha").value);

document.getElementById('advertboxsubmit').innerHTML = "&nbsp;<img src=\"/images/ajax.gif\">&nbsp;";

}

///document.getElementById('advertbox').innerHTML= '<img src="/images/ajax.gif" >';
     var url="/tills/createajax.php?"+Math.random();
   var xmlHttpReq = false;
    var self = this;
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', url, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {

        if (self.xmlHttpReq.readyState ==1 ) {
        }
 
       
        if (self.xmlHttpReq.readyState == 4) {
           if(type=="a"){ 
           document.getElementById('advertbox').innerHTML = removeNL(self.xmlHttpReq.responseText);

           }
 
            if(type=="b"){ 
                       

            document.getElementById('advertbox').innerHTML = removeNL(self.xmlHttpReq.responseText);



            }

            if(type=="c"){ 
                       

            document.getElementById('advertbox').innerHTML = removeNL(self.xmlHttpReq.responseText);



            }

        }
    }
    self.xmlHttpReq.send(params);

}




function postagentform(myform , type){

if (document.getElementById("q") && document.getElementById("prom") ){


var e=document.getElementsByName('paymentmethod');
if (e[0].checked){
var payedby = e[0].value; 
} 
if (e[1].checked){
var payedby = e[1].value; 
}

if (e[2].checked){
var payedby = e[2].value; 
}

if (e[3].checked){
var payedby = e[3].value; 
}


if (e[4].checked){
var payedby = e[4].value; 
}

var params="paymentmethod="+escape(payedby)+"&statement="+escape(document.getElementById("statement").value)+"&q="+escape(document.getElementById("q").value)+"&prom="+escape(document.getElementById("prom").value)+"&customername="+escape(document.getElementById("customername").value)+"&authcustomername="+escape(document.getElementById("authcustomername").value)+"&customeraddress1="+escape(document.getElementById("customeraddress1").value)+"&customeraddress2="+escape(document.getElementById("customeraddress2").value)+"&customercounty="+escape(document.getElementById("customercounty").value)+"&customerpostcode="+escape(document.getElementById("customerpostcode").value)+"&customercountry="+escape(document.getElementById("customercountry").value)+"&customertele="+escape(document.getElementById("customertele").value)+"&customernotes="+escape(document.getElementById("customernotes").value);

document.getElementById('gobutton').style.display="none";
}else{

document.getElementById("orderforminfo").innerHTML = "Please select quantity";
return false;
}



///document.getElementById('advertbox').innerHTML= '<img src="/images/ajax.gif" >';
     var url="/tools/agentform.php?"+Math.random();
   var xmlHttpReq = false;
    var self = this;
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', url, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {

        if (self.xmlHttpReq.readyState ==1 ) {
        }
 
       
        if (self.xmlHttpReq.readyState == 4) {

document.getElementById('gobutton').style.display="inline";

document.getElementById("orderforminfo").innerHTML = removeNL(self.xmlHttpReq.responseText);
//alert(removeNL(self.xmlHttpReq.responseText));
//window.location = removeNL(self.xmlHttpReq.responseText);
 


        }
    }
    self.xmlHttpReq.send(params);

}












function postlink(myform){
ajax();

      var params="email="+document.getElementById("advertsemail").value;
     var url="/tools/send.php";
document.getElementById("advertsemail").style.fontColor = 'grey';
document.getElementById("advertsemail").value = 'Email Address';
   var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', url, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {

        if (self.xmlHttpReq.readyState ==1 ) {
       document.getElementById('shareboxsubmit').innerHTML ='';
            document.getElementById(myform+'info').innerHTML = '<img src="/images/ajax.gif" >';
        }
 
       
        if (self.xmlHttpReq.readyState == 4) {
            document.getElementById('shareboxinfo').innerHTML = self.xmlHttpReq.responseText;
           var t=setTimeout("closesharealert()",5000);

        }
    }
    self.xmlHttpReq.send(params);
}






function closesharealert(elem){
document.getElementById('shareboxinfo').innerHTML='';
document.getElementById('shareboxsubmit').innerHTML ='&nbsp;SEND&nbsp;';
}





function doResize(){

if (parseInt(navigator.appVersion)>3) {
if (navigator.appName=="Netscape") {wW = window.innerWidth-16;}
if (navigator.appName.indexOf("Microsoft")!=-1) {  wW = document.body.offsetWidth-20; }
}
winWW= wW/80;

try{document.body.style.fontSize=winWW;}
catch(ex){alert(ex.message);}
}


function currenform(amount)
{
	var i = parseFloat(amount);
	if(isNaN(i)) { i = 0.00; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	i = parseInt((i + .005) * 100);
	i = i / 100;
	s = new String(i);
	if(s.indexOf('.') < 0) { s += '.00'; }
	if(s.indexOf('.') == (s.length - 2)) { s += '0'; }
	s = minus + s;
	return s;
}


function commaform(amount)
{
	var delimiter = ","; // replace comma if desired
	var a = amount.split('.',2)
	var d = a[1];
	var i = parseInt(a[0]);
	if(isNaN(i)) { return ''; }
	var minus = '';
	if(i < 0) { minus = '-'; }
	i = Math.abs(i);
	var n = new String(i);
	var a = [];
	while(n.length > 3)
	{
		var nn = n.substr(n.length-3);
		a.unshift(nn);
		n = n.substr(0,n.length-3);
	}
	if(n.length > 0) { a.unshift(n); }
	n = a.join(delimiter);
	if(d.length < 1) { amount = n; }
	else { amount = n + '.' + d; }
	amount = minus + amount;
	return amount;
}

/////////////Calculationsssss
////////////////////////////

function calcshowcase (value){

if(value!=0){
document.getElementById('showcaseimpressioncost').innerHTML= " ";
document.getElementById('showcaseimpressioncost').innerHTML= "&pound;"+commaform(currenform(value*0.01)) +"<br><img src=\"/images/paypal.gif\" style=\"margin-left: 0%;cursor: pointer;width: 70%;\" border=\"0\" onclick=\"showpaypalwindow("+value+",'allscreens');\" title=\"PayPal - The safer, easier way to pay online.\" alt=\"PayPal - The safer, easier way to pay online.\">";
}else{
document.getElementById('showcaseimpressioncost').innerHTML= " ";
}

}


function calcall (value){
if(value!=0){

document.getElementById('allimpressioncost').innerHTML= " ";
document.getElementById('allimpressioncost').innerHTML= "+<input type=\"text\" id=\"prom\" name=\"\" value =\""+value*0.01+ "\"style=\"font-size: 90%;width:50%;\" >Prom <br>";

document.getElementById('paradeimpression').innerHTML= " &pound;"+commaform(currenform(value*0.01)) +"<br>";

}else{
///document.getElementById('allimpressioncost').innerHTML= " <input type=\"text\" name=\"bonusstarframe\" style=\"width:100%;\"> ";
}
}

function displayallprices(value){

document.getElementById('totalamounttwo').value=commaform(currenform(value*0.01));
document.getElementById('totalamounttwo').style.border="2px blue solid";
document.getElementById('buy').innerHTML="<img src=\"/images/paypal.gif\" style=\"cursor: pointer;width: 100%;\" border=\"0\" onclick=\"showpaypalwindow2("+value+",'allscreensw',document.getElementById('prom').value);\" title=\"PayPal - The safer, easier way to pay online.\" alt=\"PayPal - The safer, easier way to pay online.\">";
document.getElementById('buy').style.display="block";
document.getElementById('agentaddressform').style.display="none";
document.getElementById('paymentbycard').checked = true;

}

function showbuy(){
document.getElementById('paymentnotice').innerHTML="";
document.getElementById('buy').style.visibility='visible';
document.getElementById('buy').style.display="block";
//document.getElementById('agentaddressform').style.visibility='hidden';
document.getElementById('agentaddressform').style.display="none";

}

function shownotice(notice){
document.getElementById('paymentnotice').innerHTML=notice;
document.getElementById('buy').style.display="none";

//document.getElementById('agentaddressform').style.visibility='visible';
document.getElementById('agentaddressform').style.display="block";
}







window.onresize = doResize;
window.onreadystate = doResize;


                       