function new_window(theURL,winName,features) {
	fer = window.open(theURL,winName,features)
  if (fer==null) 
  	alert('Your browser has a popup blocker, please disable it')
  else	{
  	fer.focus()	
	}
}

function getHTTPObject() {
  var xmlhttp = null;
  /*@cc_on
  @if (@_jscript_version >= 5)
    try {
      xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        xmlhttp = false;
      }
    }
  @else
  xmlhttp = false;
  @end @*/
  if (!xmlhttp && typeof XMLHttpRequest != 'undefined') {
    try {
      xmlhttp = new XMLHttpRequest();
    } catch (e) {
      xmlhttp = false;
    }
  }
  return xmlhttp;
}

function GetXMLValue(obj)	{
	if (obj)	{
		var node = obj;
		if (node[0])	{
			var node_val = node[0].firstChild.nodeValue;	
			return node_val;
		}
		else	{
			//window.location.reload(true);
		}
	}
	return "";
}

function GetUniqueVal()	{
	rand_no = Math.floor(Math.random() * 1000000);
	return rand_no;
}

function ParseFrmVarsToURLStr(frm_name)	{
	var frm_obj = document.getElementById(frm_name);
	var ret_str = '';
	for (i=0;i<frm_obj.elements.length;i++)	{
		var html_obj = frm_obj.elements(i);
		var html_val = -999;
		var html_name = html_obj.name;
		if (html_name)	{
			//alert(html_obj.type);
			switch (html_obj.type)	{
				case 'hidden':
				case 'text':
				case 'textarea':
					html_val = html_obj.value;
					break;
				case 'select-one':
					if (html_obj.selectedIndex > -1)	{
						html_val = html_obj.options[html_obj.selectedIndex].value;
					}
					break;
			}
			ret_str += '&' + html_name + '=' + html_val;		
		}
	}
	return ret_str;
}

function DumpMsg(msg)	{
	var span_obj = document.getElementById('dump_data');
	span_obj.innerHTML = msg;
}

function DeleteTableRows(table_id, start)	{
	var table_obj = document.getElementById(table_id);
	if (table_obj.rows.length > start)	{
		for (j2=start;j2<table_obj.rows.length;j2++)	{
			table_obj.rows[j2].style.display = 'none';
		}	
	}
}

function GetObjectValue(obj_id)	{
	var my_obj = document.getElementById(obj_id);
	var obj_val = -999;
	if (my_obj)	{
		switch (my_obj.type)	{
			case 'hidden':
			case 'text':
			case 'textarea':
				obj_val = my_obj.value;
				break;
			case 'radio':
				var my_obj_name = document.getElementsByName(my_obj.name);
				for (i=0;i<my_obj_name.length;i++)	{
					if (my_obj_name[i].checked)	{
						obj_val = my_obj_name[i].value;
						break;
					}
				}
				break;
			case 'select-one':
				if (my_obj.selectedIndex > -1)	{
					obj_val = my_obj.options[my_obj.selectedIndex].value;
				}
				break;
		}	
	}
	return obj_val;
}



function jsInArray(needle, haystack) {
  for (h in haystack) {
    if (haystack[h] == needle) {
      return true;
    // or if you prefer to get the key of the first found match use
    // return h;
    }
  }
  return false;
}

function ShowBigPic(picture_id) {
  
  
  var oImg = document.getElementById('product_big_picture');
      oImg.border = 0;
      oImg.src = 'files_lib/photo_products/photo_' + picture_id + '.jpg';
      
      //alert(oImg.src);
}

