// COUNT CHARACTERS IN TEXT FIELDS AND TEXTAREAS
function countLength(a,b,c) {
var box = document.getElementById(a);
var divCount = document.getElementById(b);
divCount.innerHTML = "" + box.value.length + "/"+c;
if (box.value.length > c) {
box.value = box.value.substring(0, c);
}
}
// DISPLAY HIDDEN DIV
function ShowHideLayer(boxID) {
/* Obtain reference for the selected boxID layer and its button */
var box = document.getElementById("box"+boxID);
var boxbtn = document.getElementById("btn"+boxID);
/* If the selected box is currently invisible, show it */
if(box.style.display == "none" || box.style.display=="") {
box.style.display = "block";
 boxbtn.src = "/images/collapse.gif";
}
/* otherwise hide it */
else {
box.style.display = "none";
boxbtn.src = "/images/expand.gif";
}
}

function stabs(src,unsrc){document.getElementById(src).style.display="block";document.getElementById(unsrc).style.display="none";}

function mvis(src){document.getElementById(src).style.display="block";}

function mremovis(src){document.getElementById(src).style.display="none";}

function stoperror(){return true}



function choosecat(fid,type){
childWindow = window.open("/cat.php?fid="+fid+"&type="+type, "choosecat", "status=1,width=400,height=400,scrollbars=1,resizable=1");
    if (childWindow.opener == null) childWindow.opener = self;
    if(!childWindow.opener)
    alert('We have detected that you are using popup blocking software.\n Please disable to choose a categorie!');
}
// FUNCTION SELECT ALL FIELDS
function selectAll()
{
    for (var i=0;i<document.myform.elements.length;i++)
      {
    var e = document.myform.elements[i];
    if ((e.name != 'list') && (e.type=='checkbox'))
      {
    e.checked = document.myform.list.checked;
      }
      }
}

// SMILIES
function add_emoticon(thisEmoticon)
{
document.myform.cpost.value += ' ' + thisEmoticon + ' ';
    document.myform.cpost.focus();
}
// DISPLAY MESSAGE
function mvis2()
{
document.getElementById("some").style.display="block";
document.getElementById("sub").style.display="none";
var obj = document.getElementById("some");
obj.innerHTML = "<div style='background: #fff; color: #ffffff; padding: 1px;'>&nbsp;&nbsp;&nbsp;Loading Content ...&nbsp;&nbsp;&nbsp;</div>";
}
function highlight(field) {
field.focus();
  field.select();
}

function toggleLayer(whichLayer, checkwhat) {
    if (document.getElementById){
var style2 = document.getElementById(whichLayer).style;
if (document.getElementById(checkwhat).checked) {
style2.display = "inline";
  }else{
    style2.display = "none";
      }
      }
}
function toggleLayerq(whichLayerq, checkwhatq) {
    if (document.getElementById){
var style2 = document.getElementById(whichLayerq).style;
if (document.getElementById(checkwhatq).checked) {
style2.display = "none";
  }else{
    style2.display = "inline";
      }
      }
}



function get(url,taid,obj) {
var getstr = "&";
for (i=0; i<obj.childNodes.length; i++) {
if (obj.childNodes[i].tagName == "TEXTAREA") {
getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";
}
if (obj.childNodes[i].tagName == "INPUT") {
if (obj.childNodes[i].type == "text") {getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";}
if (obj.childNodes[i].type == "password") {getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";}
if (obj.childNodes[i].type == "hidden") {getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";}
if (obj.childNodes[i].type == "checkbox") {
if (obj.childNodes[i].checked) {getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";}
else {getstr += obj.childNodes[i].name + "=&";}
}
if (obj.childNodes[i].type == "radio") {if (obj.childNodes[i].checked) {               getstr += obj.childNodes[i].name + "=" + obj.childNodes[i].value + "&";}}}if (obj.childNodes[i].tagName == "SELECT") {var sel = obj.childNodes[i];getstr += sel.name + "=" + sel.options[sel.selectedIndex].value + "&";}}getstr = getstr.replace(/\s+/g," ");getstr = getstr.replace(/ /g, "+");//alert(getstr,url,taid); 
scriptmeUpdateDiv(url,taid,getstr);}


var gCurrentCallID;
function scriptmeUpdateDiv(url,target,value) {
document.getElementById(target).innerHTML= "<img src=\"/images/loading.gif\"> Please wait ...";
var dTimeStamp = new Date();
gCurrentCallID = dTimeStamp.getTime();
var sURL = url + "?target=" + target + "&value=" + value + "&callid=" + gCurrentCallID;
var script=document.getElementById('script_' + target);
  if (script) script.parentNode.removeChild(script);
  script=document.createElement('SCRIPT');
  script.id='script_' + target;
  script.src=sURL;
  var head=document.getElementsByTagName('HEAD')[0];
  head.appendChild(script);
}
document.write('<script type="text/javascript" src="/js/rounded.js"></script>');

