function is_handheld() {
	if(get_cookie('is_handheld'))
    return get_cookie('is_handheld');

	var got_width = (screen.width) ? screen.width : false;
  var agent = navigator.userAgent.toLowerCase();
  var is_iphone = (agent.indexOf('iphone')!=-1);
  var is_mobile_opera = false;//(agent.indexOf('opera')!=-1) && (agent.indexOf('9.5')!=-1);
  var pos = agent.indexOf('opera');
  if(pos != -1){
    var opera_version = parseFloat(agent.substr(pos+6, 3));
    if(opera_version)
      is_mobile_opera = (opera_version >= 9.5);
  }
	if(got_width){
    //handhelds has 240x320
    if((got_width <= 320) && !(is_iphone || is_mobile_opera)){
      set_cookie('is_handheld', 'yes');
    } else {
      set_cookie('is_handheld', 'no');
    }
    return get_cookie('is_handheld');
  }
    return 'no2';
}
function js_in_array(arr,val) {
	var len = arr.length;
	for ( var x = 0 ; x <= len ; x++ ) {
		if ( arr[x] == val ) return true;
	}
	return false;
}
function set_cookie ( name, value, exp_y, exp_m, exp_d, path, domain, secure )
{
  var cookie_string = name + "=" + escape ( value );

  if ( exp_y )
  {
    var expires = new Date ( exp_y, exp_m, exp_d );
    cookie_string += "; expires=" + expires.toGMTString();
  }

  if ( path )
        cookie_string += "; path=" + escape ( path );

  if ( domain )
        cookie_string += "; domain=" + escape ( domain );

  if ( secure )
        cookie_string += "; secure";
  document.cookie = cookie_string;
}
function delete_cookie ( cookie_name )
{
  var cookie_date = new Date ( );  // current date & time
  cookie_date.setTime ( cookie_date.getTime() - 1 );
  document.cookie = cookie_name += "=; expires=" + cookie_date.toGMTString();
}
function get_cookie ( cookie_name )
{
  var results = document.cookie.match ( '(^|;) ?' + cookie_name + '=([^;]*)(;|$)' );

  if ( results )
    return ( unescape ( results[2] ) );
  else
    return null;
}