function open_window(url,name,features){
	popup=window.open(url,name,features);
	if (window.focus)
		popup.focus();
}

function ShowLangTextBox(LangI)
{
	if(LangI == 2){
			document.all.lblSpaHeadlineBox.style.display='inline';
			document.all.lblSpaEventNBox.style.display='inline';
			document.all.txtSpaEventNBox.style.display='inline';
			document.all.txtSpaHeadlineBox.style.display='inline';
	}
	if(LangI == 1){
			document.all.lblSpaHeadlineBox.style.display='none';		
			document.all.lblSpaEventNBox.style.display='none';		
			document.all.txtSpaEventNBox.style.display='none';
			document.all.txtSpaHeadlineBox.style.display='none';
		}
}
 function turnOn(layerName, layerType) {	
	if (document.getElementById) // Netscape 6 and IE 5+
    {
        var text ;
              
        if (layerType == '1'){
            text = "Add to Cart";
            }
        else if (layerType == '2'){
            text = "Details";
            }
        else if (layerType == '3'){
			text = "Add to Lightbox";
			}
			
        document.getElementById(layerName).innerHTML= text;    
    }
}

function AddedItemToCart(layerName, layerType) {	
	if (document.getElementById) // Netscape 6 and IE 5+
    {
        var text ;
        if (layerType == '3')
            text = "Add to Cart";
        //else
        //    text = "Details";
    
        document.getElementById(layerName).innerHTML= text;    
    }
}
   
function turnOff(layerName) {
    if (document.getElementById) 
    {
        var targetElement = document.getElementById(layerName);
        //targetElement.style.visibility = 'hidden';
        document.getElementById(layerName).innerHTML= "&nbsp;";
    }
}

function trim(inputString) {
    // Removes leading and trailing spaces from the passed string. Also removes
    // consecutive spaces and replaces it with one space. If something besides
    // a string is passed in (null, custom object, etc.) then return the input.
    if (typeof inputString != "string") { return inputString; }
    var retValue = inputString;
    var ch = retValue.substring(0, 1);
    while (ch == " ") { // Check for spaces at the beginning of the string
    retValue = retValue.substring(1, retValue.length);
    ch = retValue.substring(0, 1);
    }
    ch = retValue.substring(retValue.length-1, retValue.length);
    while (ch == " ") { // Check for spaces at the end of the string
    retValue = retValue.substring(0, retValue.length-1);
    ch = retValue.substring(retValue.length-1, retValue.length);
    }
    while (retValue.indexOf("  ") != -1) { // Note that there are two spaces in the string - look for multiple spaces within the string
    retValue = retValue.substring(0, retValue.indexOf("  ")) + retValue.substring(retValue.indexOf("  ")+1, retValue.length); // Again, there are two spaces in each of the strings
    }
    return retValue; // Return the trimmed string back to the user
}
<!-- Begin
function emailCheck (emailStr) {

    /* The following variable tells the rest of the function whether or not
    to verify that the address ends in a two-letter country or well-known
    TLD.  1 means check it, 0 means don't. */

    var checkTLD=1;

    /* The following is the list of known TLDs that an e-mail address must end with. */

    var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

    /* The following pattern is used to check if the entered e-mail address
    fits the user@domain format.  It also is used to separate the username
    from the domain. */

    var emailPat=/^(.+)@(.+)$/;

    /* The following string represents the pattern for matching all special
    characters.  We don't want to allow special characters in the address. 
    These characters include ( ) < > @ , ; : \ " . [ ] */

    var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

    /* The following string represents the range of characters allowed in a 
    username or domainname.  It really states which chars aren't allowed.*/

    var validChars="\[^\\s" + specialChars + "\]";

    /* The following pattern applies if the "user" is a quoted string (in
    which case, there are no rules about which characters are allowed
    and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
    is a legal e-mail address. */

    var quotedUser="(\"[^\"]*\")";

    /* The following pattern applies for domains that are IP addresses,
    rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
    e-mail address. NOTE: The square brackets are required. */

    var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

    /* The following string represents an atom (basically a series of non-special characters.) */

    var atom=validChars + '+';

    /* The following string represents one word in the typical username.
    For example, in john.doe@somewhere.com, john and doe are words.
    Basically, a word is either an atom or quoted string. */

    var word="(" + atom + "|" + quotedUser + ")";

    // The following pattern describes the structure of the user

    var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

    /* The following pattern describes the structure of a normal symbolic
    domain, as opposed to ipDomainPat, shown above. */

    var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

    /* Finally, let's start trying to figure out if the supplied address is valid. */

    /* Begin with the coarse pattern to simply break up user@domain into
    different pieces that are easy to analyze. */

    var matchArray=emailStr.match(emailPat);

    if (matchArray==null) {

        /* Too many/few @'s or something; basically, this address doesn't
        even fit the general mould of a valid e-mail address. */

        alert("Email address seems incorrect (check @ and .'s)");
        return false;
    }
    var user=matchArray[1];
    var domain=matchArray[2];

    // Start by checking that only basic ASCII characters are in the strings (0-127).

    for (i=0; i<user.length; i++) {
        if (user.charCodeAt(i)>127) {
            alert("Ths username contains invalid characters.");
            return false;
            }
        }
        for (i=0; i<domain.length; i++) {
            if (domain.charCodeAt(i)>127) {
            alert("Ths domain name contains invalid characters.");
            return false;
        }
    }

    // See if "user" is valid 

    if (user.match(userPat)==null) {
        // user is not valid
        alert("The username doesn't seem to be valid.");
        return false;
    }

    /* if the e-mail address is at an IP address (as opposed to a symbolic
    host name) make sure the IP address is valid. */

    var IPArray=domain.match(ipDomainPat);
    if (IPArray!=null) {

    // this is an IP address

    for (var i=1;i<=4;i++) {
        if (IPArray[i]>255) {
            alert("Destination IP address is invalid!");
            return false;
        }
    }
    return true;
    }

    // Domain is symbolic name.  Check if it's valid.
     
    var atomPat=new RegExp("^" + atom + "$");
    var domArr=domain.split(".");
    var len=domArr.length;
    for (i=0;i<len;i++) {
        if (domArr[i].search(atomPat)==-1) {
            alert("The domain name does not seem to be valid.");
            return false;
        }
    }

    /* domain name seems valid, but now make sure that it ends in a
    known top-level domain (like com, edu, gov) or a two-letter word,
    representing country (uk, nl), and that there's a hostname preceding 
    the domain or country. */

    if (checkTLD && domArr[domArr.length-1].length!=2 && 
    domArr[domArr.length-1].search(knownDomsPat)==-1) {
        alert("The address must end in a well-known domain or two letter " + "country.");
        return false;
    }

    // Make sure there's a host name preceding the domain.

    if (len<2) {
        alert("This address is missing a hostname!");
        return false;
    }

    // If we've gotten this far, everything's valid!
    return true;
}
function isExpiryDate(year, month) {
    //var argv = isExpiryDate.arguments;
    //var argc = isExpiryDate.arguments.length;

    //year = argc > 0 ? argv[0] : this.year;
    //month = argc > 1 ? argv[1] : this.month;

    if (!isNum(year+""))
        return false;
    if (!isNum(month+""))
        return false;
    today = new Date();
    expiry = new Date(year, month);
    if (today.getTime() > expiry.getTime())
        return false;
    else
        return true;
}

function isNum(argvalue) {
    argvalue = argvalue.toString();

    if (argvalue.length == 0)
        return false;

    for (var n = 0; n < argvalue.length; n++)
        if (argvalue.substring(n, n+1) < "0" || argvalue.substring(n, n+1) > "9")
            return false;

    return true;
}
function ReplaceChar(s1, replMe, useMe){
    var s = new String(s1);
    var array = s.split(replMe);
    return array.join(useMe);
} 
function CloseAndRefresh(url) {       
    //window.close();
    //window.opener.location.reload();
    window.opener.location=url; 
    window.close();
}
/*  ================================================================
	    FUNCTION:  isCreditCard(st)
	 
	    INPUT:     st - a string representing a credit card number

	    RETURNS:  true, if the credit card number passes the Luhn Mod-10
			    test.
		      false, otherwise
	    ================================================================ */

	function isCreditCard(st) {
	  // Encoding only works on cards with less than 19 digits
	  if (st.length > 19)
	    return (false);

	  sum = 0; mul = 1; l = st.length;
	  for (i = 0; i < l; i++) {
	    digit = st.substring(l-i-1,l-i);
	    tproduct = parseInt(digit ,10)*mul;
	    if (tproduct >= 10)
	      sum += (tproduct % 10) + 1;
	    else
	      sum += tproduct;
	    if (mul == 1)
	      mul++;
	    else
	      mul--;
	}
	// Uncomment the following line to help create credit card numbers
	// 1. Create a dummy number with a 0 as the last digit
	// 2. Examine the sum written out
	// 3. Replace the last digit with the difference between the sum and
	//    the next multiple of 10.

	//  document.writeln("<BR>Sum      = ",sum,"<BR>");
	// alert("Sum      = " + sum);

	  if ((sum % 10) == 0)
	    return (true);
	  else
	    return (false);

	} // END FUNCTION isCreditCard()



	/*  ================================================================
	    FUNCTION:  isVisa()
	 
	    INPUT:     cc - a string representing a credit card number

	    RETURNS:  true, if the credit card number is a valid VISA number.
			    
		      false, otherwise

	    Sample number: 4111 1111 1111 1111 (16 digits)
	    ================================================================ */

	function isVisa(cc)
	{
	  if (((cc.length == 16) || (cc.length == 13)) &&
	      (cc.substring(0,1) == 4))
	    return isCreditCard(cc);
	  return false;
	}  // END FUNCTION isVisa()

	/*  ================================================================
	    FUNCTION:  isMasterCard()
	 
	    INPUT:     cc - a string representing a credit card number

	    RETURNS:  true, if the credit card number is a valid MasterCard
			    number.
			    
		      false, otherwise

	    Sample number: 5500 0000 0000 0004 (16 digits)
	    ================================================================ */

	function isMasterCard(cc)
	{
	  firstdig = cc.substring(0,1);
	  seconddig = cc.substring(1,2);
	  if ((cc.length == 16) && (firstdig == 5) &&
	      ((seconddig >= 1) && (seconddig <= 5)))
	    return isCreditCard(cc);
	  return false;

	} // END FUNCTION isMasterCard()





	/*  ================================================================
	    FUNCTION:  isAmericanExpress()
	 
	    INPUT:     cc - a string representing a credit card number

	    RETURNS:  true, if the credit card number is a valid American
			    Express number.
			    
		      false, otherwise

	    Sample number: 340000000000009 (15 digits)
	    ================================================================ */

	function isAmericanExpress(cc)
	{
	  firstdig = cc.substring(0,1);
	  seconddig = cc.substring(1,2);
	  if ((cc.length == 15) && (firstdig == 3) &&
	      ((seconddig == 4) || (seconddig == 7)))
	    return isCreditCard(cc);
	  return false;

	} // END FUNCTION isAmericanExpress()




	/*  ================================================================
	    FUNCTION:  isDinersClub()
	 
	    INPUT:     cc - a string representing a credit card number

	    RETURNS:  true, if the credit card number is a valid Diner's
			    Club number.
			    
		      false, otherwise

	    Sample number: 30000000000004 (14 digits)
	    ================================================================ */

	function isDinersClub(cc)
	{
	  firstdig = cc.substring(0,1);
	  seconddig = cc.substring(1,2);
	  if ((cc.length == 14) && (firstdig == 3) &&
	      ((seconddig == 0) || (seconddig == 6) || (seconddig == 8)))
	    return isCreditCard(cc);
	  return false;
	}



	/*  ================================================================
	    FUNCTION:  isCarteBlanche()
	 
	    INPUT:     cc - a string representing a credit card number

	    RETURNS:  true, if the credit card number is a valid Carte
			    Blanche number.
			    
		      false, otherwise
	    ================================================================ */

	function isCarteBlanche(cc)
	{
	  return isDinersClub(cc);
	}

	/*  ================================================================
	    FUNCTION:  isDiscover()
	 
	    INPUT:     cc - a string representing a credit card number

	    RETURNS:  true, if the credit card number is a valid Discover
			    card number.
			    
		      false, otherwise

	    Sample number: 6011000000000004 (16 digits)
	    ================================================================ */

	function isDiscover(cc)
	{
	  first4digs = cc.substring(0,4);
	  if ((cc.length == 16) && (first4digs == "6011"))
	    return isCreditCard(cc);
	  return false;

	} // END FUNCTION isDiscover()

	/*  ================================================================
	    FUNCTION:  isEnRoute()
	 
	    INPUT:     cc - a string representing a credit card number

	    RETURNS:  true, if the credit card number is a valid enRoute
			    card number.
			    
		      false, otherwise

	    Sample number: 201400000000009 (15 digits)
	    ================================================================ */

	function isEnRoute(cc)
	{
	  first4digs = cc.substring(0,4);
	  if ((cc.length == 15) &&
	      ((first4digs == "2014") ||
	       (first4digs == "2149")))
	    return isCreditCard(cc);
	  return false;
	}

	/*  ================================================================
	    FUNCTION:  isJCB()
	 
	    INPUT:     cc - a string representing a credit card number

	    RETURNS:  true, if the credit card number is a valid JCB
			    card number.
			    
		      false, otherwise
	    ================================================================ */

	function isJCB(cc)
	{
	  first4digs = cc.substring(0,4);
	  if ((cc.length == 16) &&
	      ((first4digs == "3088") ||
	       (first4digs == "3096") ||
	       (first4digs == "3112") ||
	       (first4digs == "3158") ||
	       (first4digs == "3337") ||
	       (first4digs == "3528")))
	    return isCreditCard(cc);
	  return false;

	} // END FUNCTION isJCB()

	/*  ================================================================
	    FUNCTION:  isAnyCard()
	 
	    INPUT:     cc - a string representing a credit card number

	    RETURNS:  true, if the credit card number is any valid credit
			    card number for any of the accepted card types.
			    
		      false, otherwise
	    ================================================================ */
function isAnyCard(cc)
	{
	  if (!isCreditCard(cc))
	    return false;
//	  if (!isMasterCard(cc) && !isVisa(cc) && !isAmericanExpress(cc) && !isDinersClub(cc) && !isDiscover(cc) && !isEnRoute(cc) && !isJCB(cc)) {
	  if (!isMasterCard(cc) && !isVisa(cc) && !isAmericanExpress(cc) && !isEnRoute(cc) && !isJCB(cc)) {
	    return false;
	  }
	  return true;

	} // END FUNCTION isAnyCard()

	/*  ================================================================
	    FUNCTION:  isCardMatch()
	 
	    INPUT:    cardType - a string representing the credit card type
		      cardNumber - a string representing a credit card number

	    RETURNS:  true, if the credit card number is valid for the particular
		      credit card type given in "cardType".
			    
		      false, otherwise
	    ================================================================ */

	function isCardMatch (cardType, cardNumber)
	{
        //alert (cardType);
        //alert (cardNumber);
		cardType = cardType.toUpperCase();
		var doesMatch = true;

		//if ((cardType == "VISA") && (!isVisa(cardNumber)))
		if ((cardType == "VS") && (!isVisa(cardNumber)))
			doesMatch = false;
		//if ((cardType == "MASTERCARD") && (!isMasterCard(cardNumber)))
		if ((cardType == "MC") && (!isMasterCard(cardNumber)))
			doesMatch = false;
		if ( ( (cardType == "AX") || (cardType == "AX") )
	                && (!isAmericanExpress(cardNumber))) doesMatch = false;
		if ((cardType == "DISCOVER") && (!isDiscover(cardNumber)))
			doesMatch = false;
		if ((cardType == "JCB") && (!isJCB(cardNumber)))
			doesMatch = false;
		if ((cardType == "DINERS") && (!isDinersClub(cardNumber)))
			doesMatch = false;
		if ((cardType == "CARTEBLANCHE") && (!isCarteBlanche(cardNumber)))
			doesMatch = false;
		if ((cardType == "ENROUTE") && (!isEnRoute(cardNumber)))
			doesMatch = false;
		return doesMatch;

	}  // END FUNCTION CardMatch()


	function Test(text)
	{
		alert(text);
	
	}

	function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
	}

	function MM_preloadImages() { //v3.0
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
		if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
	}

	function MM_findObj(n, d) { //v4.01
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
	if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	if(!x && d.getElementById) x=d.getElementById(n); return x;
	}

	function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
	}

function CheckAll(){
	var lb = eval(document.forms["form"]);
	if (lb != null){
		var len = lb.elements.length;
		for (var i = 0; i < len; i++) {
			var e = lb.elements[i];
			if (e.name=="chkLightbox") {
				e.checked = true;
			}
		}
	}
}

function ClearAll(){
	var lb = eval(document.forms["form"]);
	if (lb != null){
		var len = eval(lb.elements.length);

		for (var i = 0; i < len; i++) {
			var e = eval(lb.elements[i]);
			if (e.name=="chkLightbox") {
				e.checked=false;
			}
		}
	}
}

// srcObj = whatever form object that you want to check
// illegalCharsReg = all the characters that are illegal for your application
function ChkIllegalChars(srcObj,illegalCharsReg) {
    var regex=new RegExp("[" + illegalCharsReg + "]","i");
    return regex.test(srcObj);
}

	
function JumpMenu(targ,selObj,restore){ 
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function ImageTransferConfirmation()
{
	var _theform;
	var _checked;
	var _len;
	var _element;
	
	_checked = false;
	
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		_theform = document.form;
	}
	else {
		_theform = document.forms["form"];
	}
	
	if(null != _theform){
		_len = _theform.elements.length;
		
		for(var i = 0; i < _len; i++){
			_element = _theform.elements[i];
			
			if(_element.name == "chkLightbox"){
				if(_element.checked == true){
					_checked = true;
					break;
				}
			}	
		}
		
		if(_checked == false){
			alert("Please select at least one image to transfer.");
		}
	}
	
	return _checked;
	
}


function UpdateLightBoxInfo(ddlLB, lblNumItemsID, hlLBID) {
	var currentLBI, currentLBTtl;
	var elemPrefix;
	
	if (document.getElementById) // Netscape 6 and IE 5+
    {
		currentLBI = arrLBI[ddlLB.selectedIndex];
		currentLBTtl = arrLBTtl[ddlLB.selectedIndex];

    	hlLBID = GetClientIDFromSibling(ddlLB, hlLBID);
		lblNumItemsID = GetClientIDFromSibling(ddlLB, lblNumItemsID);
	
        document.getElementById(hlLBID).href = "Lightbox.aspx?Mod=V&LBI=" + currentLBI;
        document.getElementById(lblNumItemsID).innerHTML = currentLBTtl;
    }
	//lblNumItemsID.innerHTML = currentLBTtl;
	//hlLBID.href = "Lightbox.aspx?LBI=" + currentLBI;
}

function EnsureScrollPos(txtAreabox)
{
	alert('this');

}

function DisableControl(controlToDisable)
{
	var objToDisable, tempObj
	objToDisable = document.getElementById(controlToDisable);
	objToDisable.disabled  = true;

}

function ResetControl(controlToReset)
{
	var objToDisable
	objToDisable = document.getElementById(controlToReset);
	objToDisable.disabled  = false;

}


function submit_creative_search(url, inputControl, searchBoxId, ddlTypeId, optionalControlList)
{
	var siblingIds;
	var tempCtl, tempId;
	var tempVal, tempKey;
	var searchBoxCtl, ddlTypeCtl;
	var inputForm;	
	
	if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
		inputForm = document.forms["form"];
	}
	else {
		inputForm = document.form;
	}
	//Find Search Box
	tempId = GetClientIDFromSibling(inputControl, searchBoxId);
	searchBoxCtl = document.getElementById(tempId);
	
	//Find Select Box
	tempId = GetClientIDFromSibling(inputControl, ddlTypeId);
	ddlTypeCtl = document.getElementById(tempId);
	
	//Check Values
	if(searchBoxCtl.value=="") {
		alert('Please type the word or words you\'d like to search for before clicking Search.');
		return false;
		}
		 
	if((isNaN(searchBoxCtl.value)) && ((ddlTypeCtl.value == "I") || (ddlTypeCtl.value == "E"))){
		alert("Please enter a number to search.");
		return false;
	}
	
	if((!(isNaN(searchBoxCtl.value))) && ((ddlTypeCtl.value == "I") || (ddlTypeCtl.value == "E"))){
		if (parseInt(searchBoxCtl.value) > 2147483647) {
			alert("The number you entered is too big.");
			return false;
		}
		if (parseInt(ddlTypeCtl.value) < 0) {
			alert("Please enter a positive number.");
			return false;
		}
	}
	
	
	__mvCleanAction(inputForm, searchBoxCtl.getAttribute('StateKey'), searchBoxCtl.value);
	__mvCleanAction(inputForm, ddlTypeCtl.getAttribute('StateKey'), ddlTypeCtl.value);
	
	
	// Append URL parameters
	url = url + "?str=" + searchBoxCtl.value + "&sfld=" + ddlTypeCtl.value;
	
	// See if collection ID is present
	if(document.getElementById("sbSearch_lblCollection"))
	{
		obj = document.getElementById("sbSearch_lblCollection");
		if(obj.value > 0)
		{
			// Append the collection ID
			url = url + "&Clctn=" + obj.value;
		}
	}	

	var SearchWithIn = document.getElementsByName("sbSearch:pnlSearchWithin:SearchWithin");
	var index;
	var SelectedSearchWithIn = "";
	var type="";
	var chkbxSrchRF = document.getElementById("sbSearch_chkbxSrchRF");
	var chkbxSrchRM = document.getElementById("sbSearch_chkbxSrchRM");
	var OptionSelected = false;
	
	for(index=0; index<SearchWithIn.length; index++)
	{
		if(SearchWithIn[index].checked == true)
		{
			//Assign the value
			SelectedSearchWithIn = SearchWithIn[index].value;
			OptionSelected = true;
			break;
		}
	}
	// rdoNewSearch
	if (SelectedSearchWithIn == "rdoNewSearch")
	{
		url = url;	
	}

	// rdoSearchWithin
	if (SelectedSearchWithIn == "rdoSearchWithin")
	{	
		// Rebuild the search string
		url = "ItemListing.aspx?";
		
		var HidInput=document.getElementById("sbSearch_pnlSearchWithin_hidFirstSearch");
		var str = HidInput.value;
		url = url + "&str=" + str + "&sfld=" + ddlTypeCtl.value + "&substr=" + searchBoxCtl.value;
		
		if(document.getElementById("sbSearch_lblCollection"))
		{
			obj = document.getElementById("sbSearch_lblCollection");
			if(obj.value > 0)
			{
				// Append the collection ID
				url = url + "&Clctn=" + obj.value;
			}
		}	
	
	}
		
	if(chkbxSrchRF.checked == true && chkbxSrchRM.checked == true)
	{type =2;}
	
	if(chkbxSrchRF.checked == true &&  chkbxSrchRM.checked  == false)
	{type = 0;}
	
	if(chkbxSrchRF.checked == false &&  chkbxSrchRM.checked  == true)
	{type = 2;}
	
	// Append the search type
	url = url + "&st=" + type;
	
	inputForm.__VIEWSTATE.value = "";
	inputForm.action = url;
	inputForm.submit();
}

function submit_search(url, inputControl, searchBoxId, ddlTypeId, optionalControlList)
{
	var siblingIds;
	var tempCtl, tempId;
	var tempVal, tempKey;
	var searchBoxCtl, ddlTypeCtl;
	var inputForm;	
	
	if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
		inputForm = document.forms["form"];
	}
	else {
		inputForm = document.form;
	}
	
	
	//Find Search Box
	tempId = GetClientIDFromSibling(inputControl, searchBoxId);
	searchBoxCtl = document.getElementById(tempId);
	
	//Find Select Box
	tempId = GetClientIDFromSibling(inputControl, ddlTypeId);
	ddlTypeCtl = document.getElementById(tempId);
	
	//Check Values
	if(searchBoxCtl.value=="") {
		alert('Please type the word or words you\'d like to search for before clicking Search.');
		return false;
		}
		 
	if((isNaN(searchBoxCtl.value)) && ((ddlTypeCtl.value == "I") || (ddlTypeCtl.value == "E"))){
		alert("Please enter a number to search.");
		return false;
	}
	
	if((!(isNaN(searchBoxCtl.value))) && ((ddlTypeCtl.value == "I") || (ddlTypeCtl.value == "E"))){
		if (parseInt(searchBoxCtl.value) > 2147483647) {
			alert("The number you entered is too big.");
			return false;
		}
		if (parseInt(ddlTypeCtl.value) < 0) {
			alert("Please enter a positive number.");
			return false;
		}
		
		if (ddlTypeCtl.value == "I") {
			inputForm.action="ItemDescription.asp?ItemI=" + searchBoxCtl.value;
			inputForm.submit();
			return true;
		}
	}
	
	inputForm.action = url;

	__mvCleanAction(inputForm, searchBoxCtl.getAttribute('StateKey'), searchBoxCtl.value);
	__mvCleanAction(inputForm, ddlTypeCtl.getAttribute('StateKey'), ddlTypeCtl.value);
				
	//Process optional siblings
	if(optionalControlList != undefined) {
		siblingIds = optionalControlList.split(',');
		
		for(var i=0;i<siblingIds.length; i++)
		{
			tempId = GetClientIDFromSibling(inputControl, siblingIds[i]);
			tempCtl = document.getElementById(tempId);
			if(tempCtl != undefined)
			{
				tempKey = tempCtl.getAttribute('StateKey');
				tempVal = tempCtl.value;
				
				__mvCleanAction(inputForm, tempKey, tempVal);
			}
		}
	}
	inputForm.__VIEWSTATE.value = "";
	inputForm.submit();
	
}





function SubmitPoll(Poll, Rating, Item, Sender)
{
	var result;
	var avgVotesCtl, avgRatingCtl;
	

	avgVotesCtl =  document.getElementById(GetClientIDFromSibling(Sender, "lblNumVotes"));
	avgRatingCtl = document.getElementById(GetClientIDFromSibling(Sender, "lblItemRtng"));
	
	result = mvRemoteMethods.SubmitPoll(Poll, Rating, Item);
	
	var values;
	values = result.value.split(',');
	
	avgRatingCtl.innerHTML = values[0];
	avgVotesCtl.innerHTML = values[1] + ' votes';

}
var gTitle;

/*
function KeywordSearch(Keyword,Title)
{
	var divMain, spanStatus;
	var result;

	divMain = document.getElementById("spclEvent");
	spanStatus = document.getElementById("spanStatus");
	
	divMain.innerHTML = '';
	spanStatus.innerHTML = 'Loading Page...';
	gTitle =Title;
	result = mvRemoteMethods.KeywordSearch(Keyword, KeywordSearch_Callback);

	
	
}

function KeywordSearch_Callback(result)
{
	document.getElementById("spclEvent").innerHTML = result.value[0];
	document.getElementById("spanStatus").innerHTML = gTitle;
	
	document.forms["frmSortingPgHeading"].hidItemStr2.value = result.value[1];

	
}
*/
function CelebRollover(obj, hightlighted){ 
	if (hightlighted){
		obj.style.backgroundColor="#6699cc";
	}
	else{
		obj.style.backgroundColor="";
	}
} 

function ValidateTags(frmObj,tagFieldID,errMssg){
	
	var _fullTagID;
	var _tagObj;
	var _sErrorMessage;
	var _sCharFilter;
	var _sIllegalChars;
	var _divErrObj;
	
	if(frmObj) 
	{
		if (document.getElementById) // Netscape 6 and IE 5+
		{
			_fullTagID = GetClientIDFromSibling(frmObj,tagFieldID);
			_divErrObj = document.getElementById("divTgErr");
			
			_tagObj = document.getElementById(_fullTagID).value; 
			_sErrorMessage = "";
			
			if(ChkIllegalChars(_tagObj,'@#!-$^&*\,()+=\'\"\/')) {
				if(_divErrObj)
					_divErrObj.innerHTML = errMssg;
				return false;	
			}
			_divErrObj.innerHTML = "";
			return true
		}
	}
	
	return false;
}

/* Tagging */
var tagObject=[];
var yourTags="";

function UpdateTagTextbox(tagCtl, tagContainer)
{
	var tagId = tagCtl.id;
	
	var tagContainerString = document.getElementById(tagContainer).value;
	var tagSelected = document.getElementById(tagId).innerHTML+" ";
	
	if(tagContainerString.search(tagSelected)<0)
	{
		if(tagContainerString.charAt(tagContainerString.length-1)!=" ")document.getElementById(tagContainer).value+=" ";
		document.getElementById(tagContainer).value+=tagSelected;
		//To highlight multiple tags
		for(i=0;i<tagIDList.length;i++)
 		{
			if((tagObject[i]+" ")==tagSelected)
			{
				document.getElementById(tagIDList[i]).className="tagged";
			}
		}
	}
	else
	{
		document.getElementById(tagContainer).value=tagContainerString.replace(tagSelected,"")
		//To unhighlight multiple tags
		for(i=0;i<tagIDList.length;i++)
 		{
			if((tagObject[i]+" ")==tagSelected)
			{
				document.getElementById(tagIDList[i]).className="tag";
			}
		}		
	}
}

function tags(tag, tagContainer)
{
	var tagContainerString = document.getElementById(tagContainer).value;
	var tagSelected = document.getElementById(tag).innerHTML+" ";
	if(tagContainerString.search(tagSelected)<0)
	{
		if(tagContainerString.charAt(tagContainerString.length-1)!=" ")document.getElementById(tagContainer).value+=" ";
		document.getElementById(tagContainer).value+=tagSelected;
		//To highlight multiple tags
		for(i=0;i<tagIDList.length;i++)
 		{
			if((tagObject[i]+" ")==tagSelected)document.getElementById(tagIDList[i]).className="tagged";
		}
	}
	else
	{
		document.getElementById(tagContainer).value=tagContainerString.replace(tagSelected,"")
		//To unhighlight multiple tags
		for(i=0;i<tagIDList.length;i++)
 		{
			if((tagObject[i]+" ")==tagSelected)document.getElementById(tagIDList[i]).className="tag";
		}		
	}
}

function buildTagList()
{
	for(i=0;i<tagIDList.length;i++)
	{
		tag=document.getElementById(tagIDList[i]).innerHTML;
		tagObject.push(tag);
	}
}


/*function RemoveTags(frmObj, sibblingID)
{
	//avgVotesCtl =  document.getElementById(GetClientIDFromSibling(Sender, "lblNumVotes"));
	//avgRatingCtl = document.getElementById(GetClientIDFromSibling(Sender, "lblItemRtng"));
	var theform;
	var currentID;
	var result;
	var tgCtl;
	
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		theform = document.form;
	}
	else {
		theform = document.forms["form"];
	}
	
	if(frmObj) 
	{
		if (document.getElementById) // Netscape 6 and IE 5+
		{
			tgCtl =  document.getElementById(GetClientIDFromSibling(frmObj,sibblingID)).innerHTML;
			currentID = theform.currentItem.value;
			alert(currentID);
			result = mvRemoteMethods.RemoveTags(currentID, tgCtl);
			alert(result.value);
		}
	}
	
}*/


function removeTag(frmObj, tagBlock, tag)
{
 //alert('test');
  var d = document.getElementById('yourtag');
  var olddiv = document.getElementById(GetClientIDFromSibling(frmObj,tagBlock));
  document.getElementById(GetClientIDFromSibling(frmObj,tag)).style.textDecoration="line-through";
  document.getElementById(GetClientIDFromSibling(frmObj,tag)).style.color="#ccc";
  // Start Ajax Call here, if return true, excute the following line.
		for(i=0;i<tagIDList.length;i++)
 		{
			if(tagIDList[i]==GetClientIDFromSibling(frmObj,tag))
			{
				tagObject[i]="";
			}
		}
	var theform;
	var currentID;
	var result;
	var tgCtl;

	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		theform = document.form;
	}
	else {
		theform = document.forms["form"];
	}

	if(frmObj) 
	{
		if (document.getElementById) // Netscape 6 and IE 5+
		{
			tgCtl =  document.getElementById(GetClientIDFromSibling(frmObj,tag)).innerHTML;
			try {
				currentID = theform.currentItemI.value;
			}
			catch(e) {
				currentID = theform.currentItem.value;
			}
			result = mvRemoteMethods.RemoveTags(currentID, tgCtl);
			
		}
	}


  d.removeChild(olddiv);
}
function AddTags(frmObj, tagBlock, tgTextBox) 
{
	AddTags(frmObj, tagBlock, tgTextBox, null);
}

function AddTags(frmObj, tagBlock, tgTextBox, tagContainer)
{
	var tags;
	var inputCtl;
	var theform;
	var currentID;
	var result;
	
	if (window.navigator.appName.toLowerCase().indexOf("microsoft") > -1) {
		
		theform = document.form;
	}
	else {
		theform = document.forms["form"];
	}
	
	
	try {
		currentID = theform.currentItem.value;
	}
	catch(e) {
		currentID = theform.currentItemI.value;
	}
	
	inputCtl = document.getElementById(GetClientIDFromSibling(frmObj, tgTextBox));
	tags= inputCtl.value;
	

	result = mvRemoteMethods.AddTags(currentID, tags, tagContainer, tagContainer);

	inputCtl.value = '';
	
	var tagRegion;
	
	tagRegion = document.getElementById('divTagRegion');
	
	tagRegion.innerHTML = result.value[0];
	
	
	tagIDList = result.value[1].split(',');
	tagObject=[];
	buildTagList();
	
}
/* End Tagging */

/* Special Events AJAX Support */

function GetSpecialEventListing(SpecialEventID)
{
	var theform;
	if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
		theform = document.forms["form"];
	}
	else {
		theform = document.form;
	}
	
	theform.action = "\SpecialEvents.aspx"
	CallAJAXFunction("mvRemoteMethods.GetSpecialEventListing", "e", SpecialEventID, false)
}

function CallAJAXFunction_Callback(result)
{
	document.getElementById("divGG").innerHTML = result.value;		
}

function ShowStatusMessage()
{
	divMain = document.getElementById("divGG");
	divMain.innerHTML = '<font class="smBoldTxt">Loading, please wait...</font>&nbsp;<img align="middle" border="0" src="/images/loading.gif" />';
}

function CallAJAXFunction(ClientCallBackFunction, CommandName, CommandArgument, PersistState)
{
	var divMain, spanStatus;
	var result;

	var theform;
	if (window.navigator.appName.toLowerCase().indexOf("netscape") > -1) {
		theform = document.forms["form"];
	}
	else {
		theform = document.form;
	}
	
	__mvCleanAction(theform, CommandName, CommandArgument);
	ShowStatusMessage();
	
	if(navigator.userAgent.indexOf('Safari') != -1){
		ajaxResult = eval(ClientCallBackFunction + "('" + theform.action + "')");
		CallAJAXFunction_Callback(ajaxResult);
	}
	else
	{	
		result=eval(ClientCallBackFunction + "('" + theform.action + "'," + CallAJAXFunction_Callback + ")")
	}
}

/* End Special Events AJAX Support */
function setOpener(href)
{
	if (window.opener && !window.opener.closed)
	{
		window.opener.document.location = href;
	}
}
//  End -->

