function swap(item_id) {
	$('swap_content').innerHTML = $(item_id).innerHTML;	
}

function global_popup(url, width, height) {
	var x = (screen.width/2)-(width/2);
	var y = (screen.height/2)-(height/2);
	var qs = "";
	
	var randomnumber=Math.floor(Math.random()*110);
	
	var pos = "left="+x+",top="+y;
	
	window.Window = window.open(url,"Popup"+randomnumber,"width="+width+",height="+height+","+pos+",scrollbars=yes, status=yes");
}

  function em (name, domain){
	window.location = "mailto:" + name + "@" + domain;
	}
	
	
function c(id){
  if (document.getElementById(id).checked==true)
    document.getElementById(id).checked=false;
  else
    document.getElementById(id).checked=true ;
}

function hs(hide, show){
	document.getElementById(show).style.display="block";
	document.getElementById(hide).style.display="none";
}


function append_text(id, myValue) {
myField = document.getElementById(id);

//IE support
if (document.selection) {
myField.focus();
sel = document.selection.createRange();
sel.text = myValue;
}
//MOZILLA/NETSCAPE support
else if (myField.selectionStart || myField.selectionStart == '0') {
var startPos = myField.selectionStart;
var endPos = myField.selectionEnd;
myField.value = myField.value.substring(0, startPos)
+ myValue
+ myField.value.substring(endPos, myField.value.length);
} else {
myField.value += myValue;
}

myField.focus();

}



function sms_content_update() {
    var limit = 160;
   
    var old = document.getElementById('counter').innerHTML;
    var n = document.getElementById('sms_content').value.length;
   
    document.getElementById('counter').innerHTML = n;
    
    if (n > limit) {
      document.getElementById('counter').style.color="#ff0000";   
    } else {
      document.getElementById('counter').style.color="#000000";   
    }
   

}