var website_name = "http://www.teezen.com/";
//message for confirmation box which we are using for login and delete comment 
var confirmation_msg = "You need to login to your account to perform this action.\nClick OK to continue or click Cancel to stay in this page.";
var confirmation_msg_fordel = "Do you really want to delete this comment ?\nClick OK to continue or click Cancel to stay in this page.";
//Get XMLHTTP object
function $GX(handler) {
	var objXMLHttp=null
	if (window.XMLHttpRequest) {
		objXMLHttp=new XMLHttpRequest()
	} else if (window.ActiveXObject) {
		objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
	}

	return objXMLHttp
}
//Get DOM element reference by id
function $GE(element) {
	return document.getElementById(element);
}

//Put DOM element disply style
function $GESD(element, value) {
	if ($GE(element) != undefined) {
		$GE(element).style.display = value;
	}
}

//Get element by class name
//return all objects ref in array
function $GEBCN(classname) {
	x = document.body.getElementsByTagName('*');
	var element_array = Array();
	var k = 0;
	for (var i=0; i < x.length; i++) {
	  if ( x[i].className == classname ) {
	  	element_array[k] = x[i];
	  	k++;
	  }
	}
	return element_array;
}

//Fill block of getelement by id used for div
function $BF(blockname, content) {
	if($GE(blockname) != undefined) {
		$GE(blockname).innerHTML = content;
	}
}

function $Header(XmlHttp,prm){
	XmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
	XmlHttp.setRequestHeader('A_REQUESTED_X_HEADER_UU_TZ', 'XmlHttpRequestRegister_MOZ');
	XmlHttp.send(prm);
}

function $TRIM(sString) {
	while (sString.substring(0,1) == ' ') {
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' ') {
		sString = sString.substring(0,sString.length-1);
	}
	return sString;
}


function textCounter(field,cntfield,maxlimit) {
	if (field.value.length > maxlimit) { // if too long...trim it!
		field.value = field.value.substring(0, maxlimit);
		// otherwise, update 'characters left' counter
	} else {
		$GE(cntfield).value = maxlimit - field.value.length;
	}
}

String.prototype.trim = function() {
// Strip leading and trailing white-space
return this.replace(/^\s*|\s*$/g, "");              
}
function show(val){    
    var id=val; 
    var cond=$GE(id).style.display;
    if(cond=='none'){  
      $GESD(id,'block');
      id=id+'plus';
      $GE(id).src='/image/minus.gif';
    }else{
      $GESD(id,'none');
      id=id+'plus';
      $GE(id).src='/image/plus.gif';
    }
    
}

var val_search;
function is_valset(ii,val_search){	
	var set_val=$GE(ii).value; 
	if(set_val == "" || set_val.length == 0 || set_val == 'undefined'){
		$GE(ii).value=val_search;
	}
}
var txt='';
function cnt_chr(block_id,txt_id,charcnt){
	var chr;
	var cnt;	
	chr=$GE(block_id).value;
	cnt=chr.length;	
	if(charcnt >= cnt){
		$GE(txt_id).value=charcnt-cnt;
		txt=$GE(block_id).value;
	}else{
		$GE(block_id).value=txt;
		return; 
	}
}
function open_js_window(path,w,h){
	window.open(path,"_blank","width="+w+"px, height="+h+"px, scrollbars=yes");
}
function set_height(){	      
  var win_h = document.body.clientHeight;
  var curr_h = window.screen.height - 145;
  if(curr_h > win_h ){
      var h_to_make = curr_h - win_h;
      h_to_make = (h_to_make + win_h)-300;
      $GE('mid_con_main').style.height=h_to_make+'px';
  }      
}
function ValidateEmail(Mail) {
Mail=Mail.toLowerCase();
return (Mail.search(/^([a-z]+)([a-z0-9\-\_\.]{1,100})([a-z0-9]+)\@([a-z0-9]+)([a-z0-9\-\.]*)([a-z0-9]+)\.([a-z]{2,6})$/) != -1);
}