﻿// JScript File

/* Used for embedding flashtext elements such as page titles */
    function embedFlashTitle(src, text, width, height) {
	    var hasRightVersion = DetectFlashVer(requiredMajorVersion,0,0);
	    if(hasRightVersion) { 
	        document.write('<span>');
		    AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width',''+width+'','height',''+height+'','src','/flash/'+src+'','quality', 'high', 'FlashVars', 'titletext='+text+'&wid='+width+'', 'wmode', 'transparent', 'scale','noscale','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','/flash/'+src); //end AC code
	        document.write('</span><span class="hdn">'+text+'</span>');
	    }else{
		    document.write('Unable to load flash, please check your version');
	    }
    }

/* Used for embedding flash elements such as page titles */
    function embedFlash(src, width, height) {
	    var hasRightVersion = DetectFlashVer(requiredMajorVersion,0,0);
	    if(hasRightVersion) { 
	        //document.write('<span>');
		    AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0','width',''+width+'','height',''+height+'','src','/flash/'+src+'','quality', 'high', 'wmode', 'transparent', 'scale','noscale','pluginspage','http://www.macromedia.com/go/getflashplayer','movie','/flash/'+src); //end AC code
	        //document.write('</span><span class="hdn">'+text+'</span>');
	    }else{
		    document.write('Unable to load flash, please check your version');
	    }
    }

/* Embed Quicktime */

    function embedQuicktime(src, width, height) {
        document.write('<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="'+height+'" width="'+width+'">');
        document.write('<param name="src" value="'+src+'" />');
        document.write('<param name="autoplay" value="true" />');
        document.write('<param name="controller" value="true" />');
        document.write('<embed src="'+src+'" height="'+height+'" width="'+width+'" autoplay="true" type="video/quicktime" controller="true" pluginspage="http://www.apple.com/quicktime/download/">');
        document.write('</object>');
    }

    /*sfHover = function() {
	    var sfEls = document.getElementById("mid_inner").getElementsByTagName("LI");
	    for (var i=0; i<sfEls.length; i++) {
		    sfEls[i].onmouseover=function() {
			    this.className+=" sfhover";
			    if(this.id == "product_off") 
			        document.getElementById('marketul').style.display='none';
			    if(this.id == "market_off") 
			        document.getElementById('productul').style.display='none';
		    }
		    sfEls[i].onmouseout=function() {
			    this.className=this.className.replace(new RegExp(" sfhover\\b"), "");
		        if(this.id == "product_off")
		            document.getElementById('marketul').style.display='block';
		        if(this.id == "market_off")
		            document.getElementById('productul').style.display='block';
		    }
	    }
	    var sfImgs = document.getElementsByTagName("img");
	    for (var x=0; x<sfImgs.length; x++) {
	        sfImgs[x].onmouseover=function() {
			    this.className+=" imghover";
		    }
		    sfImgs[x].onmouseout=function() {
			    this.className=this.className.replace(new RegExp(" imghover\\b"), "");
		    }
	    }
	    var sfDDs = document.getElementsByTagName("dd");
	    for (var x=0; x<sfDDs.length; x++) {
	        sfDDs[x].onmouseover=function() {
			    this.className+=" ddhover";
		    }
		    sfDDs[x].onmouseout=function() {
			    this.className=this.className.replace(new RegExp(" ddhover\\b"), "");
		    }
	    }
    }
    if (window.attachEvent) window.attachEvent("onload", sfHover); */

/* Used on the Homepage */

    function rotateProduct(product, action) {
        src = product.src.slice(0, product.src.length-6);
        if(!action)
            product.src = src + "_1.gif";
        else
            product.src = src + "_2.gif";
    }
    
/* Used on Products Landing */

    function glowproduct(product)
    {
     document.getElementById(product).src = "/images/products/ani_"+product+".gif";
    }

/* Used in Contact Us -> FAQs */

    var listx = new Array();
    function hideElement(name, id, tag, icon, shownsrc, hiddensrc) {
        var tags = document.getElementsByTagName(tag);
        
        // run loop for tags to hide
	    for(i = 0; i < tags.length; i++) {
		    if (tags[i].id == (name + id)) {
			    tags[i].style.display = "none";
		    }
	    }
    	
	    // if theres an image icon, swap the src
	    if(document.getElementById(icon)) document.getElementById(icon).src = shownsrc;
    	
	    // assign the array variable
	    listx[id] = "hidden";
    }
    
    function showElement(name, id, tag, icon, shownsrc, hiddensrc) {
        if (listx[id] == "shown") hideElement(name, id, tag, icon, shownsrc, hiddensrc);
	    else {
	        var tags = document.getElementsByTagName(tag);
	        for(i = 0; i < tags.length; i++) {
		        if (tags[i].id == (name + id)) {
			        tags[i].style.display = "block";
		        }
	        }
	        // if theres an image icon, swap the src
	        if(document.getElementById(icon)) document.getElementById(icon).src = hiddensrc;
        	
	        // assign the array variable
	        listx[id] = "shown";
        }
    }

/* Used in Contact Us -> Contact Us */


    
    /* Displays One Element at a time */
    
    function showOneElement(id, group, tag) {
        var tags = document.getElementsByTagName(tag);
        for(t = 0; t < tags.length; t++) {
            if(tags[t].className == group && tags[t].id == id) {
                tags[t].style.display = "block";   
            }else if(tags[t].className == group) {                    
                tags[t].style.display = "none";
            }
        }  
        var imgs = document.getElementsByTagName("img");
        for (i = 0; i < imgs.length; i++) {
            
            if(imgs[i].className == "topbtn btnon" || imgs[i].className == "topbtn") {
                //alert(imgs[i].id +"=="+ id+"btn");
                if(imgs[i].id != id+"btn") {
                    //alert(imgs[i].id +"=="+ id+"btn");
                   imgs[i].className = "topbtn";
                }
                document.getElementById(id+"btn").className = "topbtn btnon";
             }   
        }      
    }   



