
function choiceButtonMouseClick(url)
{
                //window.navigate(url);
                window.location.href = url;
}

function choiceButtonMouseOver(ctrlId)
{
        document.getElementById(ctrlId+"_td1").bgColor = "gray";
        document.getElementById(ctrlId+"_td2").bgColor = "darkgray";
        document.getElementById(ctrlId+"_td2").style.cursor = "hand";
}

function choiceButtonMouseOut(ctrlId)
{
        document.getElementById(ctrlId+"_td1").bgColor = "white";
        document.getElementById(ctrlId+"_td2").bgColor = "#c2c2cd";
        document.getElementById(ctrlId+"_td2").style.cursor = "default";
}
function validateSignUpEmail()
{
         var objRegex = new RegExp("^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$");
         var el = document.getElementById("WSC_61931ab619cd4eed95051697685bea28:tbEmail");
         if(el != null)
         {
                 if(jsTrim(el.value) == "")
                 {
                        alert("Email can not be blank.");
                        return false;
                 }
                 var val = el.value.replace(objRegex, "");
                 if(val != "")
                 {
                         alert("You have entered not valid email address.");
                         return false;
                 }
         }
         return true;
}

function validateFieldsMemLogin()
{
         var strResult;
         var el = document.getElementById("WSC_ec2a254ccb114dafa26abbc56b8d089c:tbUserName");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in user name.");
                         return false;
                 }
         }

         return true;
}

function validateQuickSearch()
{
         var strResult;
         var el = document.getElementById("WSC_dc5ca5ef20cf4796bb1aa18f2f011ed9:tbQuery");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in search query.");
                         return false;
                 }
         }

         return true;
}

function validateSearchReviews()
{
         var strResult;
         var el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_5c54a86d68be49fa95df629d8b718dae:tbKeywordValue1");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in keywords.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_5c54a86d68be49fa95df629d8b718dae:tbKeywordValue2");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in keywords.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_5c54a86d68be49fa95df629d8b718dae:tbKeywordValue3");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in keywords.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_5c54a86d68be49fa95df629d8b718dae:tbKeywordValue4");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in keywords.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_5c54a86d68be49fa95df629d8b718dae:tbKeywordValue5");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in keywords.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_5c54a86d68be49fa95df629d8b718dae:tbLCFrom");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in LC Classification.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_5c54a86d68be49fa95df629d8b718dae:tbLCTo");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in LC Classification.");
                         return false;
                 }
         }

         return true;
}

function validateSearchFeatures()
{
         var strResult;
         var el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_8bce7ceb2faf4892866f85b3f051f9d7:tbKeywordValue1");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in keywords.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_8bce7ceb2faf4892866f85b3f051f9d7:tbKeywordValue2");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in keywords.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_8bce7ceb2faf4892866f85b3f051f9d7:tbKeywordValue3");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in keywords.");
                         return false;
                 }
         }

         return true;
}

function validateAddSavedSearch()
{
         var strResult;
         var el = document.getElementById("rb_SaveNew");
         if(el != null)
         {
                 if(el.checked)
                 {
                        el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_b56f6eceaf61441e8be04b590a0e6302:tb_SaveName");
                        if(el != null)
                        {
                                if(jsTrim(el.value) == "")
                                {
                                        alert("Search name can not be blank.");
                                        return false;
                                }
                                if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                                {
                                        alert("You can't use special symbols in search name.");
                                        return false;
                                }
                        }

                        el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_b56f6eceaf61441e8be04b590a0e6302:ta_Desc");
                        if(el != null)
                        {
                                if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                                {
                                        alert("You can't use special symbols in description.");
                                        return false;
                                }
                        }
                 }
         }

         return true;
}

function validateAddToList()
{
         var strResult;
         var el = document.getElementById("rbCreateNew");
         if(el != null)
         {
                 if(el.checked)
                 {
                        el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_fe1ba1c062054321b423920a2cd55e9a:tbListName");
                        if(el != null)
                        {
                                if(jsTrim(el.value) == "")
                                {
                                        alert("Search name can not be blank.");
                                        return false;
                                }
                                if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                                {
                                        alert("You can't use special symbols in list name.");
                                        return false;
                                }
                        }

                        el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_fe1ba1c062054321b423920a2cd55e9a:tbDescription");
                        if(el != null)
                        {
                                if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                                {
                                        alert("You can't use special symbols in description.");
                                        return false;
                                }
                        }
                 }
         }

         return true;
}

function validateProfile()
{
         var strResult;
         var el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:tbFirstName");
         if(el != null)
         {
                  if(jsTrim(el.value) == "")
                 {
                        alert("First name can not be blank.");
                        return false;
                 }
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in first name.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:tbLastName");
         if(el != null)
         {
                  if(jsTrim(el.value) == "")
                 {
                        alert("Last name can not be blank.");
                        return false;
                 }
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in last name.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:tbInstCompany");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in company name.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:tbTitleDept");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in department name.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:tbAddress1");
         if(el != null)
         {
                  if(jsTrim(el.value) == "")
                 {
                        alert("Address can not be blank.");
                        return false;
                 }
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in address.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:tbAddress2");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in address.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:lbStateProvidence");
         if(el != null)
         {
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:lbCountry");
         if(el != null)
         {
                   if(jsTrim(el.value) == "")
                 {
                        alert("Please, Select Country.");
                        return false;
                 }
         }


         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:tbCity");
         if(el != null)
         {
                   if(jsTrim(el.value) == "")
                 {
                        alert("City can not be blank.");
                        return false;
                 }
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in city.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:tbZipCode");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in zip code.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:tbPhone");
         if(el != null)
         {
                 if(jsTrim(el.value) == "")
                 {
                        alert("Phone number can not be blank.");
                        return false;
                 }
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in phone number.");
                         return false;
                 }
         }

         var objRegex = new RegExp("^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$");
         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:tbEmail");
         if(el != null)
         {
                 if(jsTrim(el.value) == "")
                 {
                        alert("Email can not be blank.");
                        return false;
                 }
                 var val = el.value.replace(objRegex, "");
                 if(val != "")
                 {
                         alert("You have entered not valid email address.");
                         return false;
                 }
         }

         objRegex = new RegExp("^([0-9a-zA-Z]+[-._+&])*[0-9a-zA-Z]+@([-0-9a-zA-Z]+[.])+[a-zA-Z]{2,6}$");
         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:tbConfirmEmail");
         if(el != null)
         {
                 if(jsTrim(el.value) == "")
                 {
                        alert("Email can not be blank.");
                        return false;
                 }
                 var val = el.value.replace(objRegex, "");
                 if(val != "")
                 {
                         alert("You have entered not valid email address.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:tbPassword");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in password.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:tbConfirmPassword");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in password.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:tbPassword");
         var el2 = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:tbConfirmPassword");
         if(el!=null && el2!=null)
         {
                if((el.value != "" || el2.value != "") && (el.value != el2.value))
                {
                        alert("Passwords are incorrect.");
                        return false;
                }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:tbFax");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in fax number.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:tbKeyword1");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in keywords.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:tbKeyword2");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in keywords.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:tbKeyword3");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in keywords.");
                         return false;
                 }
         }


         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:tbLCClassFrom");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in LC Classification.");
                         return false;
                 }
         }

         el = document.getElementById("WSC_f498bea12ee348a8acd44162c0db6669:WSC_4459848f9aea4293b1bc41f81669b65a:tbLCClassTo");
         if(el != null)
         {
                 if(el.value.match(/[<>]|(?:%[\d\w])|(?:#[\d\w]|(&#))/))
                 {
                         alert("You can't use special symbols in LC Classification.");
                         return false;
                 }
         }

         return true;
}

function selectChildTaxonomies(chbId, ctrlName)
{
         var ctrl = document.getElementById(ctrlName);
         var arr = document.getElementsByTagName("INPUT");
         for (i =0; i < arr.length-1; i++)
         {
                if ((arr[i].type == 'checkbox') && (arr[i].name.indexOf('chb_') != -1 ) && (arr[i].name.indexOf('_'+chbId+'_') != -1))
                {
                        arr[i].checked = (ctrl != null ? ctrl.checked : false);
                }

         }

         if(ctrlName == 'clear')
         {
             var clearchb = document.getElementById('chb_ic_clearAll');
             if(clearchb != null)
             {
                        clearchb.checked = false;
             }

             clearchb = document.getElementById('chb_sa_clearAll');
             if(clearchb != null)
             {
                        clearchb.checked = false;
             }
         }
         if(ctrlName == 'chb_sa_selectAll' || ctrlName == 'chb_ic_selectAll')
         {
                if(ctrl != null)
                        ctrl.checked = false;
         }
}

function jsTrim(strInput)
{
        var strResult;
        var objRegex = new RegExp("(^\\s+)|(\\s+$)");
        strResult = strInput.replace(objRegex, "");
        return(strResult);
}


function popUp(url){
        sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=520,height=400');
        self.name = "mainWin";
}

function popUpFeedback(url){
        sealWin=window.open(url,"win",'toolbar=0,location=0,directories=0,status=1,menubar=1,scrollbars=1,resizable=1,width=700,height=350');
        self.name = "mainWin";
}

