//#### FLASH FUNCTIONS #### //v1.7 // Flash Player Version Detection // Detect Client Browser type // Copyright 2005-2007 Adobe Systems Incorporated. All rights reserved. var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false; var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false; var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false; var isVista = (navigator.userAgent.indexOf("NT 6") != -1) ? true : false; function ControlVersion() { var version; var axo; var e; // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry try { // version will be set for 7.X or greater players axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7"); version = axo.GetVariable("$version"); } catch (e) { } if (!version) { try { // version will be set for 6.X players only axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6"); // installed player is some revision of 6.0 // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29, // so we have to be careful. // default to the first public version version = "WIN 6,0,21,0"; // throws if AllowScripAccess does not exist (introduced in 6.0r47) axo.AllowScriptAccess = "always"; // safe to call for 6.0r47 or greater version = axo.GetVariable("$version"); } catch (e) { } } if (!version) { try { // version will be set for 4.X or 5.X player axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); version = axo.GetVariable("$version"); } catch (e) { } } if (!version) { try { // version will be set for 3.X player axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3"); version = "WIN 3,0,18,0"; } catch (e) { } } if (!version) { try { // version will be set for 2.X player axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash"); version = "WIN 2,0,0,11"; } catch (e) { version = -1; } } return version; } // JavaScript helper required to detect Flash Player PlugIn version information function GetSwfVer(){ // NS/Opera version >= 3 check for Flash plugin in plugin array var flashVer = -1; if (navigator.plugins != null && navigator.plugins.length > 0) { if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) { var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : ""; var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description; var descArray = flashDescription.split(" "); var tempArrayMajor = descArray[2].split("."); var versionMajor = tempArrayMajor[0]; var versionMinor = tempArrayMajor[1]; var versionRevision = descArray[3]; if (versionRevision == "") { versionRevision = descArray[4]; } if (versionRevision[0] == "d") { versionRevision = versionRevision.substring(1); } else if (versionRevision[0] == "r") { versionRevision = versionRevision.substring(1); if (versionRevision.indexOf("d") > 0) { versionRevision = versionRevision.substring(0, versionRevision.indexOf("d")); } } var flashVer = versionMajor + "." + versionMinor + "." + versionRevision; } } // MSN/WebTV 2.6 supports Flash 4 else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4; // WebTV 2.5 supports Flash 3 else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3; // older WebTV supports Flash 2 else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2; else if ( isIE && isWin && !isOpera ) { flashVer = ControlVersion(); } return flashVer; } function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision) { versionStr = GetSwfVer(); if (versionStr == -1 ) { return false; } else if (versionStr != 0) { if(isIE && isWin && !isOpera) { // Given "WIN 2,0,0,11" tempArray = versionStr.split(" "); // ["WIN", "2,0,0,11"] tempString = tempArray[1]; // "2,0,0,11" versionArray = tempString.split(","); // ['2', '0', '0', '11'] } else { versionArray = versionStr.split("."); } var versionMajor = versionArray[0]; var versionMinor = versionArray[1]; var versionRevision = versionArray[2]; // is the major.revision >= requested major.revision AND the minor version >= requested minor if (versionMajor > parseFloat(reqMajorVer)) { return true; } else if (versionMajor == parseFloat(reqMajorVer)) { if (versionMinor > parseFloat(reqMinorVer)) return true; else if (versionMinor == parseFloat(reqMinorVer)) { if (versionRevision >= parseFloat(reqRevision)) return true; } } return false; } } function Flash(flash, id, width, height, color, version, transparent){ this.width = width; this.height = height; this.flash = flash; this.id = id; this.color = color; this.transparent = transparent; this.flashvars = ""; this.parameters = ""; this.parametersEmbedded = ""; this.version = version; this.useExpressInstall = false; // functions this.addFlashVar = addFlashVar; this.addParam = addParam; this.writeFlash = writeFlash; this.expressInstall = expressInstall; } function expressInstall(flash){ var ver = this.version.split("."); // Major version of Flash required var requiredMajorVersion = ver[0]; // Minor version of Flash required var requiredMinorVersion = ver[1]; // Minor version of Flash required var requiredRevision = ver[2]; // Version check for the Flash Player that has the ability to start Player Product Install (6.0r65) var hasProductInstall = DetectFlashVer(6, 0, 65); // Version check based upon the values defined in globals var hasReqestedVersion = DetectFlashVer(requiredMajorVersion, requiredMinorVersion, requiredRevision); if(hasProductInstall && !hasReqestedVersion){ // no express install on vista IE //if(isVista && isIE){ //}else{ this.useExpressInstall = true; // change source this.flash = flash; var MMPlayerType = (isIE == true) ? "ActiveX" : "PlugIn"; var MMredirectURL = "" + window.location; MMredirectURL = MMredirectURL.replace(/&/g,"%26"); document.title = document.title.slice(0, 47) + " - Flash Player Installation"; var MMdoctitle = document.title; this.addFlashVar("MMredirectURL", MMredirectURL); this.addFlashVar("MMplayerType", MMPlayerType); this.addFlashVar("MMdoctitle", MMdoctitle); //} } } function addFlashVar(name, value){ if(this.flashvars=="") this.flashvars = name + "=" + value; else this.flashvars += "&" + name + "=" + value; } function addParam(name, value){ this.parameters += "\n"; this.parametersEmbedded += " " + name + "=\"" + value + "\""; } function writeFlash(){ var ver = this.version.split("."); var hasRightVersion = DetectFlashVer(ver[0],ver[1],ver[2]); if(hasRightVersion || this.useExpressInstall){ if(navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length){ var mode = ""; if(this.transparent) mode = "wmode=\"transparent\""; else mode = "bgcolor=\"" + this.color + "\""; var strOut = '\n'; } else{ // IE var strOut = '\n' + '\n' + '\n' + '\n' + '\n'; if(this.transparent) strOut += '\n'; else strOut += '\n'; strOut += this.parameters; strOut += '\n' strOut += '<\/object>\n'; } var obj = document.getElementById(this.id+"_alt"); if(obj){ obj.innerHTML = ""; obj.style.display = "none"; } //alert(strOut); document.write(strOut); } } //#### GENERAL FUNCTIONS #### function doPrint(){ if ((window.print) && (document.all)){ window.print(); //window.close(); } else if (window.print) { window.print(); } else if ((document.all) && !(navigator.userAgent.indexOf("Mac") != -1)) { var printWindowObject = ""; document.body.insertAdjacentHTML("BeforeEnd",printWindowObject); window.document.printWindowObject1.ExecWB(6,1); //ID=window.setTimeout("window.close();",100); } } function $(id){ return document.getElementById(id); } function openPopup(url,pwidth,pheight){ var posLeft = (parseInt(screen.width)/2) - (parseInt(pwidth)/2); var posTop = ((parseInt(screen.height)/2) - (parseInt(pheight)/2)) - 50; if(!false && url.indexOf('://') < 0) url = '/' + url; newwindow = window.open(url,null,'toolbar=0,menubar=0,location=0,directories=0,status=0,resizable=0,scrollbars=1,HEIGHT='+pheight+',WIDTH='+pwidth+',left='+posLeft+',top='+posTop); if (window.focus) newwindow.focus(); } function openQuickTour(url,pwidth,pheight){ var posLeft = (parseInt(screen.width)/2) - (parseInt(pwidth)/2); var posTop = ((parseInt(screen.height)/2) - (parseInt(pheight)/2)) - 50; newwindow = window.open(url,null,'toolbar=0,menubar=0,location=0,directories=0,status=0,resizable=0,scrollbars=0,HEIGHT='+pheight+',WIDTH='+pwidth+',left='+posLeft+',top='+posTop); if (window.focus) newwindow.focus(); } function preload(imgObj,imgSrc){ if(document.images){ eval(imgObj+' = new Image()'); eval(imgObj+'.src = "'+imgSrc+'"'); } } var isIE6 = false; if(navigator.userAgent.indexOf("MSIE 6") != -1) isIE6 = true; function imgSwap(imgName, newImgSource){ if($(imgName)){ if(!isIE6){ eval("document.getElementById('" + imgName + "').src = " + newImgSource + ".src"); }else{ $(imgName).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + eval(newImgSource + ".src") + "', sizingMethod='image')"; } } } function doChangeBorder(id){ var obj = document.getElementById(id); if(obj){ if(obj.className == "cBoxA") obj.className = "cBoxB"; else obj.className = "cBoxA"; } } //#### MODAL LAYER #### var Modal = new function() { this.show = function(content, width, height) { scroll(0,0); // Cut window and remove scrollbars var body = document.getElementsByTagName('body')[0]; body.style.height = "100%"; body.style.overflow = "hidden"; var html = document.getElementsByTagName('html')[0]; html.style.height = "100%"; html.style.overflow = "hidden"; // Create opacity overlay this.ol = el = document.createElement('DIV'); el.style.width = '110%'; el.style.height = '100%'; el.style.position = 'absolute'; el.style.backgroundColor = 'gray'; el.style.filter = 'alpha(opacity=65)'; el.style.opacity = '0.65'; el.style.left = -document.body.style.marginLeft; el.style.top = -document.body.style.marginTop; el.style.zIndex = 10000; el.onclick = function() {Modal.close();}; el.id = 'Modal_overlay'; document.body.insertBefore(el, document.body.childNodes[0]); // Create window this.ow = el = document.createElement('DIV'); el.innerHTML = content; el.style.width = width + 'px'; el.style.height = height + 'px'; el.style.position = 'absolute'; el.style.left = parseInt((parseInt(document.body.clientWidth)-width)/2) + "px"; el.style.top = '100px'; el.style.zIndex = 10001; el.id = 'Modal_window'; document.body.insertBefore(el, document.body.childNodes[0]); this.handleSelects(false); document["onkeydown"] = Modal.keyPress; if (document.getElementById('Modal_focus')) document.getElementById('Modal_focus').focus(); } this.close = function() { if (this.ol) { document.body.removeChild(document.getElementById('Modal_overlay')); document.body.removeChild(document.getElementById('Modal_window')); this.ol = null; this.ow = null; document["onkeydown"] = null; // Cut window and remove scrollbars var body = document.getElementsByTagName('body')[0]; body.style.height = ''; body.style.overflow = ''; var html = document.getElementsByTagName('html')[0]; html.style.height = ''; html.style.overflow = ''; this.handleSelects(true); } } this.keyPress = function(e) { if (!e) e=event; var key = e.keyCode; switch(key) { case 9: return false; case 27: Modal.close(); return false; default: break; } return true; } this.handleSelects = function(show) { if (navigator.appVersion.match(/\bMSIE\b/)) { var selects = document.getElementsByTagName("select"); for(var i=0; i < selects.length; i++) selects[i].style.visibility = show?"":"hidden"; } } } function createCookie(name, value, days) { if (days) { var date = new Date(); date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); var expires = "; expires=" + date.toGMTString(); } else var expires = ""; document.cookie = name + "=" + value + expires + "; path=/"; } function readCookie(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for (var i = 0; i < ca.length; i++) { var c = ca[i]; while (c.charAt(0) == ' ') c = c.substring(1, c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length); } return null; } function eraseCookie(name) { createCookie(name,"",-1); } function Querystring(qs) { // optionally pass a querystring to parse this.params = {}; if (qs == null) qs = location.search.substring(1, location.search.length); if (qs.length == 0) return; // Turn "plus" back to "space" // See: http://www.w3.org/TR/REC-html40/interact/forms.html#h-17.13.4.1 qs = qs.replace(/\+/g, ' '); var args = qs.split('&'); // parse out name/value pairs separated via & // split out each name=value pair for (var i = 0; i < args.length; i++) { var pair = args[i].split('='); var name = decodeURIComponent(pair[0]); var value = (pair.length == 2) ? decodeURIComponent(pair[1]) : name; this.params[name.toLowerCase()] = value; } } Querystring.prototype.get = function(key, default_) { var value = this.params[key.toLowerCase()]; return (value != null) ? value : default_; } Querystring.prototype.contains = function(key) { var value = this.params[key.toLowerCase()]; return (value != null); } String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); } function TryParseInt(str,defaultValue) { var retValue = defaultValue; if(typeof str != 'undefined' && str!=null && str.length>0){ if (!isNaN(str)) retValue = parseInt(str); } return retValue; } // AJAX METHODS var oXmlHttp = null; var isInCall = false; function createXMLHttp() { if (typeof XMLHttpRequest != "undefined") // Use XmlHttpRequest? { return new XMLHttpRequest(); } else if (window.ActiveXObject) // Microsoft any? { var aVersions = [ "MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0 ", "MSXML2.XMLHttp.3.0", "MSXML2.XMLHttp", "Microsoft.XMLHttp" ]; for (var i = 0; i < aVersions.length; i++) { try { var oXMLHttp = new ActiveXObject(aVersions[i]); return oXMLHttp; } catch (oError) { // alert(oError.Message); }//alert(oError.Message); } } } // Error creating request object throw new Error("XMLHttp object could not be created!"); } function SendRequest(variables) { var contactScript = variables; // Should contain complete url with params. isInCall = true; try { oXmlHttp = createXMLHttp(); oXmlHttp.open("get", contactScript, true); oXmlHttp.onreadystatechange = ParseData; // Parse the result oXmlHttp.send(null); } catch (oError) { isInCall = false; return false; } return true; } function ParseData() { if (oXmlHttp != null ) { if ( oXmlHttp.readyState == 4) { if (oXmlHttp.status == 200) { var contentType = oXmlHttp.getResponseHeader("Content-Type"); if (contentType.match("text/xml") != null) { //alert("XML content received." + oXmlHttp.responseText); } else if (contentType.match("text/plain") != null) { doGetData(oXmlHttp.responseText); } else { } } else { //alert("ERROR#" + oXmlHttp.statusText); } } } else { doGetData("Object value null."); } isInCall = false; } var caller = ""; function doSendDataAsynch(action, params){ var url = "WishlistAjax.aspx?" + params; caller = action; if(params != ""){ if (SendRequest(url)){ return false; } else { return true; } }else{ return true; } return false; } function doGetData(response){ if(response != null && response != "undefined" && response !="") { if(caller == "GetProducts") { PrintProducts(response); } } else { } } function PrintProducts(response) { var results = eval( "(" + response+ ")" ); alert(results); var arrProducts = new Array(); } // WISHLIST METHODS function WishlistLogin(username, password) { username = encodeURIComponent(username); password = encodeURIComponent(password); return doSendDataSynch("WishlistAjax.aspx?login=1&username=" + username + "&password=" + password); } function WishlistLogout() { return doSendDataSynch("WishlistAjax.aspx?logout=1"); } function WishlistCheckLoginStatus() { return doSendDataSynch("WishlistAjax.aspx?checkLogin=1"); } function WishlistRegister(firstName, lastName, email, password, moreInfo) { firstName = encodeURIComponent(firstName); lastName = encodeURIComponent(lastName); email = encodeURIComponent(email); password = encodeURIComponent(password); moreInfo = encodeURIComponent(moreInfo); return doSendDataSynch("WishlistAjax.aspx?createUser=1&firstname=" + firstName + "&lastname=" + lastName + "&email=" + email + "&password=" + password + "&moreinfo=" + moreInfo); } function WishlistUpdateUser(firstName, lastName, email, password, moreInfo) { firstName = encodeURIComponent(firstName); lastName = encodeURIComponent(lastName); email = encodeURIComponent(email); password = encodeURIComponent(password); moreInfo = encodeURIComponent(moreInfo); return doSendDataSynch("WishlistAjax.aspx?updateUser=1&firstname=" + firstName + "&lastname=" + lastName + "&email=" + email + "&password=" + password + "&moreinfo=" + moreInfo); } function WishlistGetUser() { return doSendDataSynch("WishlistAjax.aspx?getUser=1"); } function WishlistGetName() { return doSendDataSynch("WishlistAjax.aspx?getName=1"); } function WishlistGetProducts() { return doSendDataSynch("WishlistAjax.aspx?getProducts=1"); } function WishlistAddProduct(productid) { return doSendDataSynch("WishlistAjax.aspx?addProduct=1&productid=" + productid); } function WishlistRemoveProduct(productid) { return doSendDataSynch("WishlistAjax.aspx?removeProduct=1&productid=" + productid); } function GetGeoLocation() { return doSendDataSynch("GeoLocatorAJAX.aspx"); } function doSendDataSynch(action) { try { oXmlHttp = createXMLHttp(); oXmlHttp.open("get", action, false); oXmlHttp.send(null); return oXmlHttp.responseText; } catch (oError) { //alert(oError); return null; } return null; }