function replaceText(el, text) {
  if (el != null) {
    clearText(el);
    var newNode = document.createTextNode(text);
    el.appendChild(newNode);
  }
}

function changePage(el,pageno){
   if (el != null) {
	var top = el;
		  var ob = null;
		  var i = 0;
		  for ( i = 0; i < top.childNodes.length; i++ )
		  {
		  	   ob = top.childNodes[i];
		  	   ob.className = "";
		  	}
		    	
		    	ob = top.childNodes[pageno-1];
	ob.className = "current";
   }
}

function changeOpac(opacity, el) { 
 if (el != null) {
	el.style.opacity = (opacity / 100); 
	 el.style.MozOpacity = (opacity / 100); 
	 el.style.KhtmlOpacity = (opacity / 100); 
	 el.style.filter = "alpha(opacity=" + opacity + ")"; 
 }
} 

function replaceImage(el, img_src) {
 el.src=img_src
}

function replaceOnClick(el, link){
	if (el != null) {
	  el.onclick = function() { getImageDetails(link); }
	}
}

function replaceOnClick2(el, page){
	if (el != null) {
	  el.onclick = function() { getChangeSubPage(page); }
	}
}

function disableLink(el, link){
	if (el != null) {
	  el.onclick = function() { return false; }
	}
}

function show(el){
	if (el != null) {
	  el.style.display = 'block';
	}
}

function hide(el){
	if (el != null) {
	  el.style.display = 'none';
	}
}

function replaceHREF(el, link){
	if (el != null) {
		el.href = link;
	}
}

function replaceValue(el, value){
	if (el != null) {
		el.value = value;
	}
}

function clearText(el) {
  if (el != null) {
    if (el.childNodes) {
      for (var i = 0; i < el.childNodes.length; i++) {
        var childNode = el.childNodes[i];
        el.removeChild(childNode);
      }
    }
  }
}

function getText(el) {
  var text = "";
  if (el != null) {
    if (el.childNodes) {
      for (var i = 0; i < el.childNodes.length; i++) {
        var childNode = el.childNodes[i];
        if (childNode.nodeValue != null) {
          text = text + childNode.nodeValue;
        }
      }
    }
  }
  return text;
}
