function explode( delimiter, string, limit ) {
    // http://kevin.vanzonneveld.net
    // +     original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +     improved by: kenneth
    // +     improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +     improved by: d3x
    // +     bugfixed by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // *     example 1: explode(' ', 'Kevin van Zonneveld');
    // *     returns 1: {0: 'Kevin', 1: 'van', 2: 'Zonneveld'}
    // *     example 2: explode('=', 'a=bc=d', 2);
    // *     returns 2: ['a', 'bc=d']
 
    var emptyArray = { 0: '' };
    
    // third argument is not required
    if ( arguments.length < 2
        || typeof arguments[0] == 'undefined'
        || typeof arguments[1] == 'undefined' )
    {
        return null;
    }
 
    if ( delimiter === ''
        || delimiter === false
        || delimiter === null )
    {
        return false;
    }
 
    if ( typeof delimiter == 'function'
        || typeof delimiter == 'object'
        || typeof string == 'function'
        || typeof string == 'object' )
    {
        return emptyArray;
    }
 
    if ( delimiter === true ) {
        delimiter = '1';
    }
    
    if (!limit) {
        return string.toString().split(delimiter.toString());
    } else {
        // support for limit argument
        var splitted = string.toString().split(delimiter.toString());
        var partA = splitted.splice(0, limit - 1);
        var partB = splitted.join(delimiter.toString());
        partA.push(partB);
        return partA;
    }
}

var xmlHttp
function checkAll()
{

	if (!(document.form1.email.value == '') && !(document.form1.loginname.value == '') && !(document.form1.password.value == '') && (!document.form1.repassword.value == '') && (document.form1.password.value == document.form1.repassword.value))
	{
		document.form1.submit.disabled=false;
	}
	else
	{
		document.form1.submit.disabled=true;
	}
}
function checkPass()
{
	if (!(document.form1.password.value == document.form1.repassword.value)) 
	{
	 document.getElementById("Passcheck").innerHTML="<font color='#FF0000' size='1'>Passwords don't match</font>"
	}
	else
	{
	document.getElementById("Passcheck").innerHTML="<font color='#00CC00' size='1'>Passwords match</font>"	
	}
}
/* User Login Check */
function loginUser()
{

xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="scripts/login.php"
url=url+"?n="+document.loginform.username.value+"&p="+document.loginform.password.value
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedLogin
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 
function stateChangedLogin() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById('logindiv').innerHTML=xmlHttp.responseText 
 } 
}
/* End of User Login Check */

/****************************************************************************
*********************- Registration Form Checks -***************************/

/* Check if user exists */

function checkUser(str)
{
if (str.length==0)
  { 
  document.getElementById("txtHint").innerHTML=""
  return
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="scripts/checkusername.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedCheckUser
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 
function stateChangedCheckUser() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById('txtHint').innerHTML=xmlHttp.responseText 
 } 
}
/* End of username check */
/* check if mail exists */
function checkMail(str)
{
if (str.length==0)
  { 
  document.getElementById("emailcheck").innerHTML=""
  return
  }
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="scripts/checkemail.php"
url=url+"?q="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedEmail
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 
function stateChangedEmail() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById('emailcheck').innerHTML=xmlHttp.responseText 
 } 
}
/* End of emailcheck */
/****************************************************************************
*******************- End of Registration Form Checks -***********************
*****************************************************************************
*****************************************************************************
*************************- Check browser type -******************************
****************************************************************************/
function GetXmlHttpObject()
{
var xmlHttp=null;
try
 {
 // Firefox, Opera 8.0+, Safari
 xmlHttp=new XMLHttpRequest();
 }
catch (e)
 {
 // Internet Explorer
 try
  {
  xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  }
 catch (e)
  {
  xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  }
 }
return xmlHttp;
}
/****************************************************************************
************************- End of browser Check -*****************************
*****************************************************************************
*****************************************************************************
/****************************************************************************
*************************- Mouse Over Script -*******************************
****************************************************************************/
function showOver(str){
	document.getElementById(str).style.backgroundImage = "url('images/"+ str +"_over.gif')";
}
function hideOver(str){
document.getElementById(str).style.backgroundImage = "";
}
/****************************************************************************
***********************- End Of Mouse Over Script -**************************
*****************************************************************************
*****************************************************************************
****************************- Login Script -*********************************
****************************************************************************/
function showLogin(str) {
document.getElementById(str).style.display = "";
}

function hideLogin() {
document.getElementById('logindiv').style.display = "none";
}
/****************************************************************************
*************************- End Of Login Script -*****************************
*****************************************************************************
*****************************************************************************
***********************- Show / Hide Profile Script -************************
****************************************************************************/
function showAccount(str) {
	document.getElementById(str).style.display = '';
	} 
function hideAccount(str){
	document.getElementById(str).style.display = 'none';
	}
	
function setHeight() {
	var height = document.getElementById('middle').offsetHeight.value;
	document.getElementById('bannerleft').offsetHeight.value = document.getElementById('middle').offsetHeight.value;
	document.getElementById('bannerright').offsetHeight.value = document.getElementById('middle').offsetHeight.value;
}
function showAddFf() {
	document.getElementById('addff').style.display = "";
}
function addNew(str) {
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="scripts/insertff.php"
url=url+"?ff_cat="+document.fformat.ff_cat.value+"&ff_name="+document.fformat.ff_name.value
url=url+"?ff_ext="+document.fformat.ff_ext.value+"&ff_desc="+document.fformat.ff_desc.value
xmlHttp.onreadystatechange=stateChangedFformat
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 
function stateChangedFformat() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById('article_create_fileformats').innerHTML=xmlHttp.responseText 
 } 
}	
function setHeight(){
var divh = document.getElementById('rightbanner').offsetHeight;
document.getElementById('leftbanner').offsetHeight= divh;
}

function replyone(str) {
document.commentform.reply_one.value= str;
document.commentform.reply_two.value = ''
}

function replytwo(one,two) {
document.commentform.reply_two.value=two;
document.commentform.reply_one.value=one;
}

function showComment() {
document.getElementById('comment_post_form').style.display = '';
}

function selectmenu(str)
{
if (str.length==0)
  { 
  document.getElementById("sortby").innerHTML=""
  return
  }
xmlHttp=GetXmlHttpObject(str)
if (xmlHttp==null)
  {
  alert ("Browser does not support HTTP Request")
  return
  } 
var url="scripts/selectmenu.php"
url=url+"?type="+str
url=url+"&sid="+Math.random()
xmlHttp.onreadystatechange=stateChangedSelectmenu
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
} 
function stateChangedSelectmenu() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 document.getElementById('sortby').innerHTML=xmlHttp.responseText 
 } 
}

function submitform()
{
  document.searchformtop.submit();
}
function submitform2()
{
  document.searchformbottom.submit();
}

function setoffset(str)
{
	document.searchformbottom.offset.value = str;
	document.searchformtop.offset.value = str;
}

function checkAall(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = true ;
}

function uncheckAll(field)
{
for (i = 0; i < field.length; i++)
	field[i].checked = false ;
}

function setcolumn(str){
	if(str == 'articles'){
		document.getElementById('contentcolumn').value = 'article_content';
		document.getElementById('titlecolumn').value = 'article_title';
	} else if(str == 'companies'){
		document.getElementById('contentcolumn').value = 'cdesc';
		document.getElementById('titlecolumn').value = 'cname';
	}
}
function checkPrice()
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
  	{
  		alert ("Browser does not support HTTP Request")
  		return
  	} 
	var url="scripts/checkregnow.php"
	url=url+"?id="+document.getElementById('regnowid').value
	url=url+"&target=price"
	xmlHttp.onreadystatechange=stateChangedPrice
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function stateChangedPrice() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById('price').value=xmlHttp.responseText 
	 } 
}

function checkAffiliate()
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
  	{
  		alert ("Browser does not support HTTP Request")
  		return
  	} 
	var url="scripts/checkregnow.php"
	url=url+"?id="+document.getElementById('regnowid').value
	url=url+"&target=affiliate"
	xmlHttp.onreadystatechange=stateChangedAffiliate
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function stateChangedAffiliate() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById('affiliate').value=xmlHttp.responseText 
	 } 
}

function checkTrial()
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
  	{
  		alert ("Browser does not support HTTP Request")
  		return
  	} 
	var url="scripts/checkregnow.php"
	url=url+"?id="+document.getElementById('regnowid').value
	url=url+"&target=trial"
	xmlHttp.onreadystatechange=stateChangedTrial
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function stateChangedTrial() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById('trial').value=xmlHttp.responseText 
	 } 
}
function checkImage()
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
  	{
  		alert ("Browser does not support HTTP Request")
  		return
  	} 
	var url="scripts/checkregnow.php"
	url=url+"?id="+document.getElementById('regnowid').value
	url=url+"&target=image"
	xmlHttp.onreadystatechange=stateChangedImage
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}
function stateChangedImage() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 document.getElementById('banner').value=xmlHttp.responseText 
	 } 
}

function checkProduct()
{
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
  	{
  		alert ("Browser does not support HTTP Request")
  		return
  	} 	
	var url="scripts/checkregnow.php"
	url=url+"?id="+document.getElementById('regnowid').value
	url=url+"&target=product"
	xmlHttp.onreadystatechange=stateChangedProduct
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)

} 

function stateChangedProduct() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	 var string = xmlHttp.responseText
	 var expl = explode('::', string)
	 document.getElementById('productname').value = '';
	 document.getElementById('productname').value=expl[0]; 
	 document.getElementById('pricetotal').value='';
	 document.getElementById('pricetotal').value=expl[1];
	 document.getElementById('affiliate').value='';
     document.getElementById('affiliate').value=expl[2];
	 document.getElementById('imageurl').value='';
	 document.getElementById('imageurl').value=expl[3];
	 document.getElementById('trial').value='';
	 document.getElementById('trial').value=expl[4];
	 document.getElementById('vendorname').value='';
	 document.getElementById('vendorname').value=expl[5];
	 document.getElementById('url').value='';
	 document.getElementById('url').value=expl[6];
	 } 
}
