function mycenteralpopwinVHS(fname,width,height)
{
	var file
	var sWidth	= 200
	var sHeight = 200
	
	if(width.length > 0)
	{
		sWidth = width;
	}
	else
	{
		width =100;
	}
	
	if(height.length > 0)
	{
		sHeight = height;
	}
	else
	{
		height =100;
	}
	
	file = fname
	file =file	
	
	var wintop  =window.screen.height;
	var winleft =window.screen.width;
	wintop  =(wintop/2) - (height/2)
	winleft =(winleft/2) - (width/2)
		
	if ( sWidth > window.screen.availWidth )
		{ sWidth = window.screen.availWidth; }
	if (sHeight > window.screen.availHeight )
		{ sHeight = window.screen.availHeight; }
	if ( parseInt(sWidth) < width )
		{ sWidth = width; }
	if ( parseInt(sHeight) < height )
		{ sHeight = height; }
	
	if ((navigator.appName == "Microsoft Internet Explorer") || (navigator.appName == "Netscape") )
		{ window.open(file, "_blank", "status=no, scrollbars=yes, toolbar=no, resizable=yes, location=no, menubar=no, top=" + wintop + ", left= "+ winleft +", height=" + sHeight + ", width=" + sWidth); 
		}
	/*if ( navigator.appName == "Netscape" ) 
		{ 
		window.open(file,"_blank","scrollbars=yes,alwaysRaised,resizable=yes,dependant,innerheight=" + sHeight + ",innerwidth=" + sWidth); 		 
		//window.open(file,"_blank","alwaysRaised,dependant,scrollbars=yes,innerheight=" + sHeight + ",innerwidth=" + sWidth); 
		}*/
}

function GetXmlHttpObject()
{
	var xmlHttp=null;
	try
	{
		// Firefox, Opera 8.0+, Safari
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		//Internet Explorer
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
		}
	}
	return xmlHttp;
}
function popup(page_name,divname)
{	
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	var url=page_name;
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{
			document.getElementById(divname).innerHTML=	xmlHttp.responseText;	
			fireMyPopup(divname);
			
		}
		
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}

function popupmodule_submit(page_name,divname)
{	
	xmlHttp=GetXmlHttpObject();
	if(xmlHttp==null)
	{
		alert("Browser does not support HTTP Request");
		return;
	}
	var url=page_name;
	xmlHttp.onreadystatechange = function()
	{
		if(xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
		{
			document.getElementById(divname).innerHTML=	xmlHttp.responseText;	
			fireMyPopup(divname);
			
		}
		
	}
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null)
}



// is blank
	function isBlank(obj, msg) 
	{ 
		
		if(obj.value==null) 
		{ 
		return msg;
		//obj.focus(); 
		return false; 
		} 
		for(var i=0;i<obj.value.length;i++) 
		{ 
			if(obj.value.charAt(i) ==' ') 
				break; 
			if ((obj.value.charAt(i)!="\t")&&(obj.value.charAt(i)!="\n")&&(obj.value.charAt(i)!="\r")) 
				{ return ''; } 
		} 
			return msg;
			//obj.focus(); 
			//obj.select(); 
	}
	function validateAlphaNumeric(obj, msg)
		{
			var validStr = /^[a-zA-Z0-9\s]{1,}$/;
			if (validStr.test(obj.value) != false)
			{
				return '';
			}
			return msg;
		}

	<!-- Script by hscripts.com -->
	/*function alphanumeric(alphane,msg)
	{
		var numaric = alphane;
		for(var j=0; j<numaric.length; j++)
			{
			  var alphaa = numaric.charAt(j);
			  var hh = alphaa.charCodeAt(0);
			  if((hh > 47 && hh<58) || (hh > 64 && hh<91) || (hh > 96 && hh<123))
			  {
			  }
			else	{
				 return false;
			  }
			}
	 return msg;
	}*/
<!-- Script by hscripts.com -->

	
	function validateRadioCheck(fieldName, msg)
		{
			count = 0;
			var arr = document.getElementsByName(fieldName);
			var choice = false;
						
			if(fieldName == 'txt_engage_buss[]')
			{
				for(r=0;r<arr.length;r++)
				{
					if (arr[r].checked == true){
						count = count +1;
						choice = true;
					}
				}
				
				if (count < 1 )
					{
						//alert(msg);
						//arr[0].focus();
						return msg;
					}
					else
						return "";
			}
			else
			{
					for(r=0;r<arr.length;r++)
					{
						if (arr[r].checked == true)
						choice = true;
					}
					
					if (!choice)
					{
						//alert(msg);
						//arr[0].focus();
						return msg;
					}else
					return "";
			}
			
			
		}
		
		function validateEmail(obj, msg)
		{
			var emailStr = /^[a-zA-Z][\w\.-]*[a-zA-Z0-9]@[a-zA-Z0-9][\w\.-]*[a-zA-Z0-9]\.[a-zA-Z][a-zA-Z\.]*[a-zA-Z]$/;
			if (emailStr.test(obj.value) == false)
			{
				
				//obj.focus();
				//obj.select();
				return msg;
			}
			return "";
		}
		
	
		
		function goInsertMeta()
		{
			var selKey = "";
			var frmElement	= document.frmMeta['chMeta[]'];
			
			if(frmElement.length)
			{
				for(k=0;k<frmElement.length;k++)
				{
					if(frmElement[k].checked == true)
					{
						selKey  = selKey + frmElement[k].value + ",";
					}
				}
				
				selKey = document.getElementById("txtMetaKey").value + selKey;
				document.getElementById("txtMetaKey").value = selKey;
				fadeOutMyPopup('styled_popup');
			}
			else
			{
				frmElement = document.getElementById('chMeta[]');
				if(frmElement.checked == true)
				{
					selKey = frmElement.value;
					selKey = document.getElementById("txtMetaKey").value + selKey;
					document.getElementById("txtMetaKey").value = selKey;
					fadeOutMyPopup('styled_popup');
				}
			}
			
		}//fun
		function getMultiple(ob) 
		{ 
			
			var opts = document.getElementById("selKeywords").options;
			var selVals = "";
			for(var i=0; i<opts.length;i++)
			{
				if(opts[i].selected && opts[i].value != '')
				{
					selVals += opts[i].value + ",";
				}//if
			}//for
			if(selVals.length > 0 )
			{
				popup('admin_meta_keywords.php?arIds='+selVals,'styled_popup');
			}
		}//fun
		
			function getMultipleKeywords(ob) 
		{ 
			
			var opts = document.getElementById("selKeywords").options;
			var selVals = "";
			for(var i=0; i<opts.length;i++)
			{
				if(opts[i].selected && opts[i].value != '')
				{
					selVals += opts[i].value + ",";
				}//if
			}//for
			if(selVals.length > 0 )
			{
				popup('meta_keywords.php?arIds='+selVals,'styled_popup');
			}
		}//fun
		
		function textCounter(field,cntfield,maxlimit,divname)
{
	
	if (field.value.length > maxlimit) {
		field.value = field.value.substring(0, maxlimit);
		alert(maxlimit + " character limit is overflow");	
		document.getElementById(divname).innerHTML	=  maxlimit + " character limit is overflow.";
	}
	else
	{
		cntfield.value = maxlimit - field.value.length;
		
		if(cntfield.value == 0 ) {
			//alert(maxlimit + " character limit is overflow");
			document.getElementById(divname).innerHTML	=  maxlimit + " character limit is overflow.";
		}
		else
			document.getElementById(divname).innerHTML = '';	  	
	}
}

function chk_blank_char_limit(field,frmvalue,msg,divname,enter_select,count_field,limitchar,divMax)
{
	
	//chkBlank(frmvalue,msg,divname,enter_select);
	
	if(frmvalue!='')
	{
		textCounter(field,count_field,limitchar,divMax);
	}else
	{
		document.getElementById(divMax).innerHTML = '';
		count_field.value = parseInt(limitchar) ;
	}
}

function LTrim( value ) {
     	var re = /\s*((\S+\s*)*)/;
   	return value.replace(re, "$1");
    	
}
    
    // Removes ending whitespaces
    function RTrim( value ) {
    	
   	var re = /((\s*\S+)*)\s*/;
   	return value.replace(re, "$1");
   	
   }

function popup_show(tmp_id)
{
	document.getElementById(tmp_id).style.display = 'block';
}	
function popup_hide(tmp_id)
{
	document.getElementById(tmp_id).style.display = 'none';
}


function AddConfirm(ProductID,frmName)
{
	
	if(confirm('Are you sure to add this product in your wishlist.'))
	{
		
		frmName.prod_id.value	= ProductID;
		frmName.action			= "";
		frmName.submit();
	}
	else
	{
		return false;
	}
}
