function shareTool(height, width, argumentString){
	javascript:return tb_show('', "/_Product_AjaxSharingTool.php?height="+height+"&width="+width+"&"+argumentString, ''); 
}

function submitenter(myfield,e)
{
var keycode;
if (window.event) keycode = window.event.keyCode;
else if (e) keycode = e.which;
else return true;

if (keycode == 13)
   {
   verimport();
   return false;
   }
else
   return true;
}
function trimAll( strValue ) {
var objRegExp = /^(\s*)$/;

    //check for all spaces
    if(objRegExp.test(strValue)) {
       strValue = strValue.replace(objRegExp, '');
       if( strValue.length == 0)
          return strValue;
    }

   //check for leading & trailing spaces
   objRegExp = /^(\s*)([\W\w]*)(\b\s*$)/;
   if(objRegExp.test(strValue)) {
       //remove leading and trailing whitespace characters
       strValue = strValue.replace(objRegExp, '$2');
    }
  return strValue;
}
function check_email(e) 
{
	ok = "1234567890qwertyuiop[]asdfghjklzxcvbnm.@-_QWERTYUIOPASDFGHJKLZXCVBNM";
	var i=0;
	for(i=0; i < e.length ;i++)
	{
		if(ok.indexOf(e.charAt(i))<0)
		{ 
			return (false);
		}
	} 
		
	if (document.images) 
	{
		re = /(@.*@)|(\.\.)|(^\.)|(^@)|(@$)|(\.$)|(@\.)/;
		re_two = /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/;
		if (!e.match(re) && e.match(re_two)) 
		{
			return (-1);
		} 
	}	
}
function contactsImportVerification()
{
	if(trimAll(document.getElementById('username').value)=='Your User Name')
	{
		alert('Please complete your email address.');
		document.getElementById('username').focus();
		return false;
	}
	if(trimAll(document.getElementById('username').value)=='')
	{
		alert('Please complete your email address.');
		document.getElementById('username').focus();		
		return false;
	}
	if(trimAll(document.getElementById('password').value)=='')
	{
		alert('Please insert your password');
		document.getElementById('password').focus();		
		return false;
	}
	document.getElementById('userCustomMessage').value	= escape(document.getElementById('customMessage').value);
	userContactsImport(500, 600, "actiontype=importUserContacts&service="+document.getElementById('service').value+"&username="+document.getElementById('username').value+"&passowrd="+document.getElementById('password').value+"&designId="+document.getElementById('designId').value+"&shareType="+document.getElementById('shareType').value);
	//document.getElementById('message').innerHTML="<img src='s-t-a-f/images/loader.gif' border=0 hspace=0 vspace=0>";
	
	return false;
}

function userContactsImport(height, width, argumentString){
	javascript:return tb_show('', "/_Product_AjaxSharingTool.php?height="+height+"&width="+width+"&"+argumentString, '');
}


function importcontacts(username,password)
{
	javascript:return tb_show('', "_Product_Ajaxvotingimportcontacts.php?height=500&width=500&username"+username+"&password="+password, '');
}

function selectAll(selectAllCHKName, checkBoxName){

	var checkUncheck	= true;
	if(document.getElementById(selectAllCHKName).checked==false)
		checkUncheck	= false;
	var checkBoxObj		= document.getElementsByName(checkBoxName);	
	
	var checkBoxLength	= checkBoxObj.length;
	
	for(var i=0;i<checkBoxLength;i++){
		checkBoxObj[i].checked	= checkUncheck;
	}
	
}

function sendPostData(uri, object, callback_function, callback_parameter){
	var xmlhttp = getXMLHttpRequest();
    var bAsync = true;
    if (!callback_function) {
        bAsync = false;
    }
    xmlhttp.open('POST', uri, bAsync);
    xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    var form_contents = '';
    for (var i in object) {
        form_contents += (form_contents ? '&' : '') + i + '=' + escape(object[i]);
    }
    xmlhttp.send(form_contents);

    if (bAsync) {
        if (callback_function) {
            xmlhttp.onreadystatechange = function() {
                if (xmlhttp.readyState == 4)
                    callback_function(xmlhttp.responseText, xmlhttp, callback_parameter);
            }
        }
        return true;
    } else {
        return xmlhttp.responseText;
    } 
}

function getXMLHttpRequest(){
    if (typeof XMLHttpRequest == 'undefined') {
       try { return new ActiveXObject("Msxml2.XMLHTTP.6.0"); }
      catch (e) {}
    try { return new ActiveXObject("Msxml2.XMLHTTP.3.0"); }
      catch (e) {}
    try { return new ActiveXObject("Msxml2.XMLHTTP"); }
      catch (e) {}
    //Microsoft.XMLHTTP points to Msxml2.XMLHTTP.3.0 and is redundant
    throw new Error("This browser does not support XMLHttpRequest.");

    }
    else {
        return new XMLHttpRequest();
    }
}

function checkValue(obj, originalValue){
	if(obj.value=='')
			obj.value=originalValue;
}