//if (top.location != self.location)top.location=self.location;
 
function mo(id){
	url = '/makeorder.php?channel=' + id;
	window.open(url,'', "width=500,height=200");
}
function rs(id){
	url = '/regard_subject.php?subjectID=' + id;
	window.open(url,'', "width=500,height=200");
}
function unsub_program(id){
	url = '/util/unsub_channel.php?channel=' + id;
	window.open(url,'', "width=500,height=200");
}

function initSelectValue(obj,v) {
	var n = obj.options.length;
	var i;
	for(i=0;i<n;i++) {
		if(obj.options(i).value==v) {
			obj.options(i).selected = true;
			return true;
		}
	}
	return false;
}


function validateEmail(emailStr){
	//var emailStr = obj.value;
	var failure = 'Invalid email';
	var reg1 = /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/; // not valid
	var reg2 = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,3}|[0-9]{1,3})(\]?)$/; // valid
	if ( !reg1.test( emailStr ) && reg2.test( emailStr ) || emailStr == '' ){
	    //obj.value == emailStr
	    return true;
	}else{	 
	  return false;	
	}
}

function trim2(value)
{
   var temp = value;
   var obj = /^(\s*)([\W\w]*)(\b\s*$)/;
   if (obj.test(temp)) { temp = temp.replace(obj, '$2'); }
   var obj = /  /g;
   while (temp.match(obj)) { temp = temp.replace(obj, " "); }
   if (temp==" ")
   {
	return "";
   }
   return temp;
}

