function getParameter ( queryString, parameterName ) { // Add "=" to the parameter name (i.e. parameterName=value) var parameterName = parameterName + "="; if ( queryString.length > 0 ) { // Find the beginning of the string begin = queryString.indexOf ( parameterName ); // If the parameter name is not found, skip it, otherwise return the value if ( begin != -1 ) { // Add the length (integer) to the beginning begin += parameterName.length; // Multiple parameters are separated by the "&" sign end = queryString.indexOf ( "&" , begin ); if ( end == -1 ) { end = queryString.length } // Return the string return unescape ( queryString.substring ( begin, end ) ); } // Return "null" if no parameter has been found return "null"; } } // FUNCTION FOR EXPANDING or COLLAPSING ANY SINGLE WIDGET function toggleWidget(WidgetID,Action) { if(Action=='open') { document.getElementById(WidgetID).style.display='block'; document.getElementById(WidgetID+'-hide').style.display='block'; document.getElementById(WidgetID+'-show').style.display='none'; } else { document.getElementById(WidgetID).style.display='none'; document.getElementById(WidgetID+'-show').style.display='block'; document.getElementById(WidgetID+'-hide').style.display='none'; } } // END // FUNCTIONS FOR EXPANDING/COLLAPSING TITLE LISTS ON HOME/CATEGORY/MY SWC PAGES function initializeTabs () { openLists = "null" if(top.location.search) { // Open each list that is specified in the query string QueryString=top.location.search.toString(); openLists = getParameter(QueryString, 'openLists'); } if (openLists != "null") { divider="," openListNames=openLists.split(divider); for (i = 0; i < openListNames.length; i++) { toggleTitleList(openListNames[i],''); } } else { collapseAllTabs(); toggleTitleList('bestsellers',''); toggleTitleList('premiertitles',''); } } counter=0 tabcounter=0 function toggleTitleList(ListName,Option){ listID=ListName+'list'; if (document.getElementById(listID) != null) { if(Option=='open') { if(counter==0) { document.getElementById(listID).style.display='block'; counter=1; } else { } } if(Option=='otherlink') { if(document.getElementById(listID).style.display=='block') { } else { document.getElementById(listID).style.display='block'; document.getElementById(ListName+'-show').style.display='none'; document.getElementById(ListName+'-hide').style.display='block'; } } else { if(document.getElementById(listID).style.display=='block') { document.getElementById(listID).style.display='none'; document.getElementById(ListName+'-hide').style.display='none'; document.getElementById(ListName+'-show').style.display='block'; } else { document.getElementById(listID).style.display='block'; document.getElementById(ListName+'-show').style.display='none'; document.getElementById(ListName+'-hide').style.display='block'; } } tabcounter=0; for (x = 0; x < ListNames.length; x++) { var list = document.getElementById(ListNames[x]+'list'); if(list != null && list.style.display=='none') { tabcounter++; } else { if(list != null && list.style.display=='') { tabcounter++; } else { } } } if(tabcounter==ListNames.length) { for (x = 0; x < ListNames.length; x++) { var all_show = document.getElementById(ListNames[x]+'-all-show'); var all_hide = document.getElementById(ListNames[x]+'-all-hide'); if (all_show != null) { all_show.style.display='block'; } if (all_hide != null) { all_hide.style.display='none'; } } } else { } tabcounter=0; for (x = 0; x < ListNames.length; x++) { var list = document.getElementById(ListNames[x]+'list'); if(list != null && list.style.display=='block') { tabcounter++; } else { } } if(tabcounter==ListNames.length) { for (x = 0; x < ListNames.length; x++) { var all_show = document.getElementById(ListNames[x]+'-all-show'); var all_hide = document.getElementById(ListNames[x]+'-all-hide'); if (all_show != null) { all_show.style.display='none'; } if (all_hide != null) { all_hide.style.display='block'; } } } else { } } } function expandAllTabs() { for (x = 0; x < ListNames.length; x++) { var list = document.getElementById(ListNames[x]+'list'); if (list != null) { list.style.display='block'; document.getElementById(ListNames[x]+'-show').style.display='none'; document.getElementById(ListNames[x]+'-hide').style.display='block'; document.getElementById(ListNames[x]+'-all-show').style.display='none'; document.getElementById(ListNames[x]+'-all-hide').style.display='block'; } } } function collapseAllTabs() { counter=1; for (x = 0; x < ListNames.length; x++) { var list = document.getElementById(ListNames[x]+'list'); if (list != null) { list.style.display='none'; document.getElementById(ListNames[x]+'-hide').style.display='none'; document.getElementById(ListNames[x]+'-show').style.display='block'; document.getElementById(ListNames[x]+'-all-show').style.display='block'; document.getElementById(ListNames[x]+'-all-hide').style.display='none'; } } } function collapseAllHelps() { for (x = 0; x < HelpNames.length; x++) { document.getElementById(HelpNames[x]+'help').style.display='none'; document.getElementById(HelpNames[x]+'help-hide').style.display='none'; document.getElementById(HelpNames[x]+'help-show').style.display='block'; } } // END // FUNCTIONS FOR EXPANDING/COLLAPSING THE MENU ITEMS IN THE BROWSE BY CATEGORY WIDGET function toggleCatList(ListName,Status){ listID=ListName+'list'; if(Status=='open') { if(counter==0) { document.getElementById(listID).style.display='block'; counter=1 } else { } } if(document.getElementById(listID).style.display=='block'){ document.getElementById(listID).style.display='none'; document.images[ListName].src='images/shared/expand.gif'; } else { document.getElementById(listID).style.display='block'; document.images[ListName].src='images/shared/collapse.gif'; } } var MenuImageName = new Array( "Navigation" ); function expandAllCats() { document.getElementById('menuhide').style.display='block'; document.getElementById('menushow').style.display='none'; document.getElementById('menuhidebtm').style.display='block'; document.getElementById('menushowbtm').style.display='none'; for (x = 0; x < MenuImageName.length; x++) { document.images[MenuImageName[x]].src='images/shared/collapse.gif'; document.getElementById(MenuImageName[x]+'list').style.display="block"; } } function collapseAllCats() { counter=1; document.getElementById('menuhide').style.display='none'; document.getElementById('menushow').style.display='block'; document.getElementById('menuhidebtm').style.display='none'; document.getElementById('menushowbtm').style.display='block'; for (x = 0; x < MenuImageName.length; x++) { document.images[MenuImageName[x]].src='images/shared/expand.gif'; document.getElementById(MenuImageName[x]+'list').style.display="none"; } } // END //preferred for "image" rollovers /* Standards Compliant Rollover Script Author : Daniel Nolan http://www.bleedingego.co.uk/webdev.php */ function initRollovers() { if (!document.getElementById) return var aPreLoad = new Array(); var sTempSrc; var aImages = document.getElementsByTagName('img'); for (var i = 0; i < aImages.length; i++) { if (aImages[i].className == 'imgover') { var src = aImages[i].getAttribute('src'); var ftype = src.substring(src.lastIndexOf('.'), src.length); var hsrc = src.replace(ftype, '_over'+ftype); aImages[i].setAttribute('hsrc', hsrc); aPreLoad[i] = new Image(); aPreLoad[i].src = hsrc; aImages[i].onmouseover = function() { sTempSrc = this.getAttribute('src'); this.setAttribute('src', this.getAttribute('hsrc')); } aImages[i].onmouseout = function() { if (!sTempSrc) sTempSrc = this.getAttribute('src').replace('_over'+ftype, ftype); this.setAttribute('src', sTempSrc); } } } } window.onload = initRollovers; // END // FUNCTION FOR OPENING URL IN A PARENT WINDOW FROM A CHILD POPUP WINDOW function OpenInParentWindow(ExtURL,CloseChild){ if(top.opener==null){ window.open(ExtURL,"") } else{ top.opener.focus() top.opener.location=ExtURL } if(CloseChild=='close'){ parent.top.close() } } // END // FUNCTION FOR OPENING POPUP WINDOW // always include a value for "winname" - this ensures that only content designed for that popup loads in the window function NewNamedWindow(pageurl,winname,wide,tall,scroll) { window.open(pageurl,winname,"toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=" + scroll + ",resizable=0,width=" + wide + ",height=" + tall + ",left=25,top=25"); } // END // FUNCTION TO OPEN A NEW FULL BROWSER function NewBrowser(pageurl) { window.open(pageurl); } // END // FUNCTIONS FOR NAVIGATING TO URL IN PARENT WINDOW FROM FORM SELECTION IN POPUP FormSelectValue='' function SelectVariable (whichItem) { var whichDest = whichItem[whichItem.selectedIndex].value; if (whichDest == "") { whichItem.selectedIndex = 0; } else { FormSelectValue = whichDest; } } function ForwardToSelectedURL (errormsg) { if(FormSelectValue=='') { window.alert(errormsg) } else { OpenInParentWindow(FormSelectValue,'close') } } // END // FUNCTIONS FOR SUBMITTING FORMS USING ENTER function submitenter(myfield,e) { var keycode; if (window.event) keycode = window.event.keyCode; else if (e) keycode = e.which; else return true; //alert(navigator.appName); if (keycode == 13 && navigator.appName == "Microsoft Internet Explorer") { myfield.form.submit(); return false; } else return true; } // FUNCTION TO SET THE CURSOR FOCUS ON A GIVEN ELEMENT function setFocus(elementId) { document.getElementById(elementId).focus(); }