function BusinessSearch() {
	var BnsSearch = document.frmBusinessSearch;
	if (!BnsSearch.q.value) {
	  alert ('Please Fill The Search Box');
	  BnsSearch.q.focus();
	  return false;
	}
	
	if (BnsSearch.q.value.length<=2) {
	  alert ('Please Fill In Product or Company Not Less Than 3 Characters');
	  BnsSearch.q.focus();
	  return false;
	}
	
	if (BnsSearch.by[0].checked==false && BnsSearch.by[1].checked==false && BnsSearch.by[2].checked == false) {
	  alert ('Please Select Product or Company or Tel Number');
	  return false;
	}

	var keyword = BnsSearch.q.value;
	keyword = keyword.replace(/%20/gi, "+");
	BnsSearch.q.value = keyword;
	
	if (BnsSearch.by[0].checked==true) {
		BnsSearch.action ="/businessfinder/product_listing.php";
		BnsSearch.submit();
		return true;
	} else if (BnsSearch.by[1].checked==true || BnsSearch.by[2].checked == true) {
		BnsSearch.action ="/businessfinder/company_listing.php";
		BnsSearch.submit();
		return true;
	}
}

function changeText()
{
	var BnsSearch = document.frmBusinessSearch;
	if (BnsSearch.by[0].checked==true) {
		document.getElementById('prodText').style.display = 'block';
		document.getElementById('compText').style.display = 'none';
	} else if (BnsSearch.by[1].checked==true || BnsSearch.by[2].checked == true) {
		document.getElementById('prodText').style.display = 'none';
		document.getElementById('compText').style.display = 'block';
	}
}

///////Drop//////

var DDSPEED = 2;
var DDTIMER = 15;
var ss;
var dd_last_mouseover = null, dd_last_click = null;
var global_left_dropdown_arrow,global_right_dropdown_arrow;
var global_left_dropdown_arrow_top,global_left_dropdown_arrow_left,global_right_dropdown_arrow_top,global_right_dropdown_arrow_left;

function menu(name, left, right)
{
	this.name = name;
  this.left = left;
  this.right = right;	
}

function moving_menu(elm_id)
{
  this.root_id = elm_id;
  this.num_menu = 0;
  this.scroll_timer;
  this.curr_scroll_pos = 0;
  this.dest_scroll_pos = 0;
  this.scrolling_table = $(this.root_id + '_table');
  this.scroll_width = parseInt($(this.root_id + '_scroll').style.width);
  this.menus = new Array();
  this.right_menu = 0;
  this.total_width = 0;
  this.divider_width = 2;
  this.scroll_timer = false;
  this.move_direction = 0;
  
  this.init = function()
  {
    var elmt = $(this.root_id + '_div');
    this.num_menu = elmt.getElementsByTagName('dl').length;
    var tds = this.scrolling_table.getElementsByTagName('th');
    var left = this.scrolling_table.style.left;
    if (left == '') left = 0;
    var init_right = parseInt(left) + this.scroll_width;
    for (var i = 0; i < tds.length; i++)
    {
			tds[i].onmouseover = function() {ddMenu(this.id, 1)};
      tds[i].onmouseout = function() {ddMenu(this.id, -1)};
      var width = parseInt(tds[i].width) + this.divider_width;
      var left = this.total_width;
      var right = this.total_width + width - 1;
			var name = tds[i].id;
      if (init_right >= left && init_right <= right) this.right_menu = i;
      this.menus.push(new menu(name, left, right));
      this.total_width += width;
    }
		this.curr_scroll_pos = parseInt(this.scrolling_table.style.left);
    this.updateNavigation();		
  };
	
	this.getActivePos = function (active_name){
		var pos = 0;
		for (var i = 0; i < this.menus.length; i++){
			menu_name = this.menus[i].name;
			pos = this.menus[i].right;
			if(active_name == menu_name){				
				//alert(active_name+" "+ menu_name)
				break;
			}
    }
		return pos;
	}
	
	this.initScroll = function(destination){
		if ( destination != 0 ) { //if destination 0 then processing this code...
			//document.getElementById(destination+'-ddheader').style.backgroundImage='url(/img/business_finder/nav_bar/bg-bar_active.gif)';
			document.getElementById(destination+'-ddheader').style.backgroundPosition='0px -829px';
			
			/*
			active_width = document.getElementById(destination+'-ddheader').width;
			new_pos = this.getActivePos(destination+'-ddheader');
			new_pos = (new_pos - (active_width) - this.divider_width) * -1;
			//alert(new_pos);
			if(new_pos<-245){
				new_pos = new_pos + 245;
				this.move_direction = -1;
				if (!this.scroll_timer)
				{
					var obj = this;
					this.scroll_timer = setInterval(function()
						{
							obj.scroll(50);
							if(obj.curr_scroll_pos < new_pos){
								obj.stopScroll();
							}
						}, 1
					);
				}
			}*/
		}
	}
  
  this.updateNavigation = function()
  {
    var obj = this;
    if (this.scroll_width - this.curr_scroll_pos < this.total_width)
    {
      var right_scroll = $(this.root_id + '_right');
      //right_scroll.src = 'http://' + location.hostname + '/img/map/bar-right-pointing.gif';
	  //right_scroll.src = 'http://' + location.hostname + '/img/business_finder/bizfinder_images.png';
      right_scroll.style.backgroundPosition = '-394px -96px';
	 // right_scroll.style.top = '-96px';
	  //right_scroll.style.left = '-394px';
      right_scroll.style.cursor = 'pointer';
      right_scroll.onmousedown = function()
      {
        obj.startScroll(-1);
      };
      right_scroll.onmouseup = function()
      {
        obj.stopScroll();
      };
			right_scroll.onmouseover = function()
      {
        setHoverArrow('right')
      };
			right_scroll.onmouseout = function()
			{
				obj.stopScroll();
				setOutArrow('right');
			};
    }
    else
    {
      var right_scroll = $(this.root_id + '_right');
      //right_scroll.src = 'http://' + location.hostname + '/img/map/bar-right-pointing-dead.gif';
	  //right_scroll.src = 'http://' + location.hostname + '/img/business_finder/bizfinder_images.png';
	  right_scroll.style.backgroundPosition = "-411px -96px";
	  //right_scroll.style.top = '-96px';
	  //right_scroll.style.left = '-411px';
	  right_scroll.style.cursor = 'default';
      right_scroll.onmousedown = null;
      right_scroll.onmouseup = null;
			global_right_dropdown_arrow = right_scroll.src;
			global_right_dropdown_arrow_top = right_scroll.style.top;
			global_right_dropdown_arrow_left = right_scroll.style.left;
    }
    
    if (this.curr_scroll_pos < 0)
    {
      var left_scroll = $(this.root_id + '_left');
      //left_scroll.src = 'http://' + location.hostname + '/img/map/bar-left-pointing.gif';
      //left_scroll.src = 'http://' + location.hostname + '/img/business_finder/bizfinder_images.png';
	  left_scroll.style.backgroundPosition = "-394px -71px";
	  //left_scroll.style.top = '-71px';
	  //left_scroll.style.left = '-394px';
      left_scroll.style.cursor = 'pointer';
      left_scroll.onmousedown = function()
      {
        obj.startScroll(1);
      };
      left_scroll.onmouseup = function()
      {
        obj.stopScroll();
      };
			left_scroll.onmouseover = function()
      {
        setHoverArrow('left')
      };
			left_scroll.onmouseout = function()
			{
				obj.stopScroll();
				setOutArrow('left');
			};
    }
    else
    {
      var left_scroll = $(this.root_id + '_left');
      //left_scroll.src = 'http://' + location.hostname + '/img/map/bar-left-pointing-dead.gif';
      left_scroll.style.backgroundPosition = '-411px -71px';
	  //left_scroll.src = 'http://' + location.hostname + '/img/business_finder/bizfinder_images.png';
	  //left_scroll.style.top = '-71px';
	  //left_scroll.style.left = '-411px';
	  left_scroll.style.cursor = 'default';
      left_scroll.onmousedown = null;
      left_scroll.onmouseup = null;
			global_left_dropdown_arrow = left_scroll.src;
			global_left_dropdown_arrow_top = left_scroll.style.top;
			global_left_dropdown_arrow_left = left_scroll.style.left;
			
    }
  };
  
  this.startScroll = function(direction)
  {
    this.move_direction = direction;
    if (!this.scroll_timer)
    {
      var obj = this;
      this.scroll_timer = setInterval(function()
        {
          obj.scroll();
        }, 10
      );
    }
  };
  
  this.stopScroll = function()
  {
    if (this.scroll_timer)
    {
      clearInterval(this.scroll_timer);
      this.scroll_timer = false;
      this.updateNavigation();
    }
  };
  
  this.scroll = function(interval)
  {
		if(interval)
			var move_distance = interval * this.move_direction;
		else
	    var move_distance = this.getMoveDistance() * this.move_direction;
    this.curr_scroll_pos += move_distance;
    if (this.move_direction < 0)
    {
      if (this.scroll_width - this.curr_scroll_pos > this.total_width) this.curr_scroll_pos = this.scroll_width - this.total_width;
      if (this.scroll_width - this.curr_scroll_pos > this.menus[this.right_menu].right && this.right_menu < this.menus.length - 1) ++this.right_menu;
      if (this.scroll_width - this.curr_scroll_pos == this.total_width) this.stopScroll();
    }
    else if (this.move_direction > 0)
    {
      if (this.curr_scroll_pos > 0) this.curr_scroll_pos = 0;
      if (this.scroll_width - this.curr_scroll_pos < this.menus[this.right_menu].left) --this.right_menu;
      if (this.curr_scroll_pos == 0) this.stopScroll();
    }
    this.scrolling_table.style.left = this.curr_scroll_pos + 'px';
  };
  
  this.getMoveDistance = function()
  {
    return 5;
  };
  
  this.init();
}

// main function to handle the mouse events //
function ddMenu(elm_id,d){
  var id = elm_id.split('-', 2)[0];
  var h = $(id + '-ddheader');
  var c = $(id + '-ddcontent');
  if (!c) return;
  var t = $('moving_menu_table');
  var left_t = t.style.left;
  if (left_t == '') left_t = 0;
  else left_t = parseInt(left_t);
  c.style.left = (0 + h.offsetLeft + left_t) + 'px';
	c.style.top = '-3px';
	//c.style.top = '-4px';
  clearInterval(c.timer);
  clearTimeout(ss);
  if(d == 1){
		mouseOverDropdown(h);
    clearTimeout(h.timer);
    if(c.maxh && c.maxh <= c.offsetHeight){return}
    else if(!c.maxh){
      c.style.display = 'block';
      c.style.height = 'auto';
      c.maxh = c.offsetHeight;
	  c.style.height = '0px'; 
    }
    ss = setTimeout(function() {
      c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
      }, 300
    );
  }else{
    h.timer = setTimeout(function(){ddCollapse(c);mouseOutDropdown(h);},50);
  }
}

// collapse the menu //
function ddCollapse(c){
  c.timer = setInterval(function(){ddSlide(c,-1)},DDTIMER);
}

// cancel the collapse if a user rolls over the dropdown //
function cancelHide(id){
  var h = $(id + '-ddheader');
	mouseOverDropdown(h);
  var c = $(id + '-ddcontent');
  clearTimeout(h.timer);
  clearInterval(c.timer);
  if(c.offsetHeight < c.maxh){
    c.timer = setInterval(function(){ddSlide(c,1)},DDTIMER);
  }
}

// incrementally expand/contract the dropdown and change the opacity //
function ddSlide(c,d){
  var currh = c.offsetHeight;
  var dist;
  if(d == 1){
    dist = (Math.round((c.maxh - currh) / DDSPEED));
  }else{
    dist = (Math.round(currh / DDSPEED));
  }
  if(dist <= 1 && d == 1){
    dist = 1;
  }
  c.style.height = currh + (dist * d) + 'px';
  c.style.opacity = currh / c.maxh;
  c.style.filter = 'alpha(opacity=' + (currh * 100 / c.maxh) + ')';
  if((currh < 2 && d != 1) || (currh > (c.maxh - 2) && d == 1)){
    clearInterval(c.timer);
  }
}

function goToParent(parentLink) {
	document.location = parentLink;	
}

//ismail
function mouseOverDropdown(elm)
{
	if (dd_last_mouseover != null)
	{
		if (elm != dd_last_mouseover) mouseOutDropdown(dd_last_mouseover);
		else return false;
	}
	if (dd_last_click == elm) return false;
	var imgs = elm.getElementsByTagName('img');
	var img = imgs[0];
	//img.src = 'http://' + location.hostname + '/img/map/downarrow-active.gif';
	//img.src = 'http://' + location.hostname + '/img/business_finder/nav_bar/arrow.gif';
	//img.style.left = '-463px';
	
	//var arrow = document.getElementById("img_downarrow-bar");
	//arrow.style.backgroundPosition = "-463px -161px";
	var old_ie = is_safari = is_ie = false;
	if (navigator.appVersion.indexOf('MSIE') != -1)
	{
		is_ie = true;
		var arVersion = navigator.appVersion.split("MSIE");
		if (parseFloat(arVersion[1]) == 6) old_ie = true;
	}
	else if (navigator.appVersion.indexOf('Safari') != -1 || window.opera) is_safari = true;
	var tmp = elm;
	var first_child = tmp.childNodes[0];
	//$(id+'-ddheader').style.backgroundImage='url(/img/business_finder/nav_bar/bg-bar_active.gif)';
	//document.getElementById(destination+'-ddheader').style.backgroundPosition='0px -215px';
	
	tmp.style.backgroundPosition='0px -761px';
	//tmp.style.backgroundImage='url(/img/business_finder/nav_bar/bg.gif)';
	
	//var img = document.createElement('img');
//	img.src = 'http://' + location.hostname + '/img/business_finder/nav_bar/shadow_top.gif';
//	img.height = '3';
//	img.width = parseInt(tmp.offsetWidth) - 1;
//		//if (old_ie || is_safari) img.style.cssText = 'position: relative; top: -2px; left: 1px; border: 0px';
//	if (old_ie || is_safari) img.style.cssText = 'position: relative; top: -2px; left: 1px; border: 0px';
//	else img.style.cssText = 'position: relative; top: -3px; *top: -5px; left: 1px; border: 0px';
//	tmp.insertBefore(img, first_child);
//	img = document.createElement('img');
//	img.src = 'http://' + location.hostname + '/img/business_finder/nav_bar/shadow_top-right.gif';
//	img.height = 3;
//	img.width = 2; 
//	if (old_ie || is_safari) img.style.cssText = 'position: relative; top: -5px; left: ' + (parseInt(tmp.offsetWidth)) + 'px';
//	else img.style.cssText = 'position: relative; top: -6px; *top: -7px; left: ' + (parseInt(tmp.offsetWidth)) + 'px';
//	tmp.insertBefore(img, first_child);
//	img = document.createElement('img');
//	img.src = 'http://' + location.hostname + '/img/business_finder/nav_bar/shadow_top-left.gif';
//	img.height = 3;
//	img.width = 2; 
//	if (old_ie || is_safari) img.style.cssText = 'position: relative; top: -5px; left: -3px';
//	else img.style.cssText = 'position: relative; top: -6px; *top: -7px; left: -3px';
//	tmp.insertBefore(img, first_child);
//	img = document.createElement('img');
//	img.src = 'http://' + location.hostname + '/img/business_finder/nav_bar/shadow_bottom.gif';
//	img.height = '3';
//	img.width = parseInt(tmp.offsetWidth) - 1; 
//	if (is_safari) img.style.cssText = 'position: relative; top: 6px; left: 1px';
//	else img.style.cssText = 'position: relative; top: 5px; *top: 6px !important; left: 1px';
//	tmp.appendChild(img);
//	img = document.createElement('img');
//	img.src = 'http://' + location.hostname + '/img/business_finder/nav_bar/shadow_bottom-right.gif';
//	img.height = 3;
//	img.width = 2; 
//	if (is_safari) img.style.cssText = 'position: relative; top: 3px; left: ' + (parseInt(tmp.offsetWidth)) + 'px';
//	else img.style.cssText = 'position: relative; top: 2px; *top: 3px; left: ' + (parseInt(tmp.offsetWidth)) + 'px';
//	tmp.appendChild(img);
//	img = document.createElement('img');
//	img.src = 'http://' + location.hostname + '/img/business_finder/nav_bar/shadow_bottom-left.gif';
//	img.height = 3;
//	img.width = 2; 
//	if (is_safari) img.style.cssText = 'position: relative; top: 3px; left: -3px';
//	else img.style.cssText = 'position: relative; top: 2px; *top: 3px; left: -3px';
//	tmp.appendChild(img);
//	
//	if (is_ie && tmp.nextSibling)
//	{
//		var right_border = tmp.nextSibling.childNodes[0];
//		right_border.src = 'http://' + location.hostname + '/img/business_finder/nav_bar/border_right.gif';
//	}
//	else if (!is_ie && tmp.nextSibling.nextSibling)
//	{
//		var right_border = tmp.nextSibling.nextSibling.childNodes[0];
//		right_border.src = 'http://' + location.hostname + '/img/business_finder/nav_bar/border_right.gif';
//	}
	
	dd_last_mouseover = elm;
}

function mouseOutDropdown(elm)
{
	if (dd_last_mouseover == null) return false;
	var is_ie = false;
	if (navigator.appVersion.indexOf('MSIE') != -1) is_ie = true;
	var tmp = elm;
	var imgs = tmp.getElementsByTagName('img');
	if (imgs.length == 1) return false;
	tmp.style.backgroundPosition='0px -730px';
	//alert(imgs[5].src);
	//tmp.style.backgroundImage='url(http://' + location.hostname + '/img/map/bg-bar.gif)';
	//tmp.removeChild(imgs[5]);
	//tmp.removeChild(imgs[4]);
	//tmp.removeChild(imgs[3]);
	//imgs[3].src = 'http://' + location.hostname + '/img/map/downarrow-bar.gif';
	//imgs[3].style.left = '-456px';
	//var arrow = document.getElementById("img_downarrow-bar");
	//arrow.style.backgroundPosition = "-456px -161px";
	//tmp.removeChild(imgs[2]);
	//tmp.removeChild(imgs[1]);
	//tmp.removeChild(imgs[0]);
	
	if (is_ie && tmp.nextSibling)
	{
		var right_border = tmp.nextSibling.childNodes[0];
		right_border.src = 'http://' + location.hostname + '/img/map/bar-divider.gif';
	}
	else if (!is_ie && tmp.nextSibling.nextSibling)
	{
		var right_border = tmp.nextSibling.nextSibling.childNodes[0];
		right_border.src = 'http://' + location.hostname + '/img/map/bar-divider.gif';
	}
	
	dd_last_mouseover = null;
}

//lavinia
function setHoverArrow_backup(type)
{
	if(type=="left")
	{
		global_left_dropdown_arrow = $('moving_menu_left').src;
		if($('moving_menu_left').src != 'http://' + location.hostname + '/img/map/bar-left-pointing-dead.gif') 
			$('moving_menu_left').src = 'http://' + location.hostname + '/img/map/left_arrow_hover.gif';
	}
	else
	{
		global_right_dropdown_arrow = $('moving_menu_right').src;
		if($('moving_menu_right').src != 'http://' + location.hostname + '/img/map/bar-right-pointing-dead.gif') 
			$('moving_menu_right').src = 'http://' + location.hostname + '/img/map/rightarrow_hover.gif';
	}
}

//lavinia
function setOutArrow_backup(type)
{
	if(type=="left")
		$('moving_menu_left').src = global_left_dropdown_arrow;
	else
		$('moving_menu_right').src = global_right_dropdown_arrow;
}



function setHoverArrow(type)
{
	if(type=="left")
	{	
		if ($('moving_menu_left').style.backgroundPosition == '-394px -71px')
		$('moving_menu_left').style.backgroundPosition = '-428px -71px';
	}
	else
	{
		if ($('moving_menu_right').style.backgroundPosition == '-394px -96px')
		$('moving_menu_right').style.backgroundPosition = '-428px -96px';
	}
}

function setOutArrow(type)
{
	if(type=="left"){
		if ($('moving_menu_left').style.backgroundPosition != '-411px -71px')
		$('moving_menu_left').style.backgroundPosition = '-394px -71px';
	}else{

		if ($('moving_menu_right').style.backgroundPosition != '-411px -96px')
		$('moving_menu_right').style.backgroundPosition = '-394px -96px';
	}
}

function showFooterAds(id)
{
	if(id == 0)
	{
		document.getElementById("divAdsHide").style.display = "block";
		document.getElementById("divAdsShow").style.display = "none";
	}
	else
	{
		document.getElementById("divAdsHide").style.display = "none";
		document.getElementById("divAdsShow").style.display = "block";
	}
}


//detail page
var statDiv = 0;
function showDivAlpha()
{
	if(statDiv == 0)
	{
		document.getElementById("iconFirst").src = "/img/button/icon_minus.gif";
		document.getElementById("divAlpha").style.display = "block";
		statDiv = 1;
	}
	else
	{
		document.getElementById("iconFirst").src = "/img/button/icon_plus.gif";
		document.getElementById("divAlpha").style.display = "none";
		statDiv = 0;
	}
}

function redirectTo(url)
{
		location.href = url
}


	
	function leftMouseOver(){
		if(document.getElementById("bannerTrigger").value==0){
			document.getElementById("left").style.cursor = "default";
			document.getElementById("scroll_left").style.backgroundPosition = "-136px -139px";
		}
		else{
			document.getElementById("scroll_left").style.backgroundPosition = "-260px -139px";
		}
	}
	function leftMouseOut(){
		if(document.getElementById("bannerTrigger").value==0){
			document.getElementById("scroll_left").style.backgroundPosition = "-136px -139px";
			document.getElementById("left").style.cursor = "default";
		}
		else{
			document.getElementById("scroll_left").style.backgroundPosition = "-198px -139px";
		}
	}
	function rightMouseOver(){
		if(document.getElementById("bannerTrigger").value==document.getElementById("maxPremium").value){
			document.getElementById("right").style.cursor = "default";
			document.getElementById("scroll_right").style.backgroundPosition = "-167px -139px";
		}
		else{
			document.getElementById("scroll_right").style.backgroundPosition = "-291px -139px";
		}
	}
	function rightMouseOut(){
		if(document.getElementById("bannerTrigger").value==document.getElementById("maxPremium").value){
			document.getElementById("scroll_right").style.backgroundPosition = "-167px -139px";
			document.getElementById("right").style.cursor = "default";
		}else{
			document.getElementById("scroll_right").style.backgroundPosition = "-229px -139px";
		}
	}		
	

function showContentBox(tabId){
	if (tabId==0){
			document.getElementById("content_tab_about_us_1").style.display="block";
			document.getElementById("content_tab_about_us_2").style.display="none";
			document.getElementById("tab_title_about_us").style.background="";
			document.getElementById("tab_title_category").style.background="url(/img/business_finder/footer/bg_title_tab_about_us.gif)";
			document.getElementById("tab_title_about_us").className="TextBold Link18";
			document.getElementById("tab_title_category").className="TextBold Link29";
	}else if (tabId==1){
			document.getElementById("content_tab_about_us_1").style.display="none";
			document.getElementById("content_tab_about_us_2").style.display="block";
			document.getElementById("tab_title_about_us").style.background="url(/img/business_finder/footer/bg_title_tab_about_us.gif)";
			document.getElementById("tab_title_category").style.background="url()";
			document.getElementById("tab_title_about_us").className="TextBold Link29";
			document.getElementById("tab_title_category").className="TextBold Link18";
	}
}

function bookmark(url,title){
   if (document.all)
     window.external.AddFavorite(url, title);
   else if (window.sidebar)
     window.sidebar.addPanel(title, url, "")
   else if (window.sidebar&&window.sidebar.addPanel)
     window.sidebar.addPanel(title,url,"");
}
//document.all covers IE, window.sidebar covers FireFox and the 3rd one covers Netscape.



//email page
function submitBizzEmail() {
		//var str=document.frmEmail.toEmail.value;
		var message=document.frmEmail.body.value;
		var from=document.frmEmail.fromEmail.value;
		var country=document.frmEmail.country.value;
		var phone=document.frmEmail.fromPhone.value;
		var chap=document.frmEmail.txtImage.value;
		single_pattern=new RegExp('^[a-zA-Z0-9]+(([_]|\\.|-)?[a-zA-Z0-9])*@([a-zA-Z0-9]+([_]|-?[a-zA-Z0-9])*(\\.))+[a-zA-Z]{2,4}$');
		pattern=new RegExp('^[a-zA-Z0-9]+(([_]|\\.|-)?[a-zA-Z0-9])*@([a-zA-Z0-9]+([_]|-?[a-zA-Z0-9])*(\\.))+[a-zA-Z]{2,4}(,[a-zA-Z0-9]+(([_]|\\.|-)?[a-zA-Z0-9])*@([a-zA-Z0-9]+([_]|-?[a-zA-Z0-9])*(\\.))+[a-zA-Z]{2,4})*$');

		/* if(str.search(pattern)){
			alert("Please input a valid email address, separate email with comma(,)");
			document.frmEmail.toEmail.focus();
			return false;
		} */
		if(!message){
			alert("Please Input the message!");
			document.frmEmail.body.focus();
			return false;
		}
		if(from.search(single_pattern)){
			alert("Please input a valid email address");
			document.frmEmail.fromEmail.focus();
			return false;
		}
		if(!country){
			alert("Please Input the country!");
			document.frmEmail.country.focus();
			return false;
		}
		if(!phone || isNaN(phone)){
			alert("Please Input valid phone number (numeric)!");
			document.frmEmail.fromPhone.focus();
			return false;
		}
		if(!chap){
			alert("Please Input the Turing Code");
			document.frmEmail.txtImage.focus();
			return false;
		}
		
		document.frmEmail.submit();
			
	}
	
	function getPhoneCode()
	{
		f = document.frmEmail;
		var cnt = new Array();
		cnt = f.country.value.split('-');
		if(f.country.value != "")
		{
			f.phone_code.value = cnt[1];
		}
	}
	
