﻿
//************************ list of video item# ***********************************

var itemList = " ";

//gog1 video = 38
itemList += "107426 KMKIII678GC 051415490 JU2S45X PI-17502-03 M730903 1-709039 209301 1-111031P-12 220025 "; 
itemList += "JXS9F21 JS92F300M THUN380PDT15 S2022243YBS 51415490 BCWA1F-16M4 91199 02050 3848950260 982 ";
itemList += "JXF5F45 JU2S60X CW4543 T150D ARLB0019/PS ME380 60 MPA30T-A 37001 54125-MOS 3301 KP345PR ";
itemList += "KSP321XL-C 5847-RUG 4901-RUG 10/22-RB 811002 1-247099P-17 1-145039P 1-845041 41010 ";

//gog2 video = 41
itemList += "NAA-22MSC 84373 MKIII6 PT-22B WAP22003 162810 163050 163810 150551 73820 JXF4F21 ";         
itemList +=  "XDM9212HCSP PG-22502-03 PT-23502-03 KP944TH P90T 745001 PCX745R TISG4194 NV-455 "; 
itemList +=  "THUN380DTCT 209304 91102 1-920159-17 051002393 66B4 R46102 51340 18951 H001 6513 2245050 ";
itemList +=  "GERG2224AK47W 021001102 BCWA3F-14M4IZ PCWVMS-24FVAR9 MT6601 3835980040 SU-16 60001-REM ";
itemList +=  "531051220 ";

//gog3 video = 53
itemList += "DDB-22 J212104 10622 813000 J320500 2-651129 M605-2B 999101 163070 NAA-380GUARDIAN 209301 " +
        +" XD9101HCSP06 XD9801HCSP06 206300 XD9802HCSP06 CW4043 PF-21502-03 44SS4 AC45G2 47917 81201 31023 87W " +
        + "012-211304 NPI-2S6 55340 S411220BS 1238 1208 1226 GERG522CB22 H004 DXT22LR3O 18682 TTRXAS JRTB318 " +
        + "HWR66209+ 85637 336W 336SDG 031539246 3108929100 915150 84218 SB2-608 5566 7111-RUG 18912 031001226 " +
        + "R92-50011  7402 SB2-457 CR-45LCDDB-22 J212104 10622 813000 J320500 2-651129 M605-2B 999101 163070 " +
        + "NAA-380GUARDIAN 209301 XD9101HCSP06 XD9801HCSP06 206300 XD9802HCSP06 CW4043 PF-21502-03 44SS4 AC45G2 " +
        + "47917 81201 31023 87W 012-211304 NPI-2S6 55340 S411220BS 1238 1208 1226 GERG522CB22 H004 DXT22LR3O 18682 " +
        + "TTRXAS JRTB318 HWR66209+ 85637 336W 336SDG 031539246 3108929100 915150 84218 SB2-608 5566 7111-RUG 18912 " +
        + "031001226 R92-50011 7402 SB2-457 CR-45LC ";         


//GOGSS2010 = 72
itemList += "3701 3313 1748 10140 5759 5902-RUG P95PR 1895SDG 60 PI-27502 ";
itemList += "TTRXAS 534153142 1232 1-191109 163420  1894 O7810D P92150703 ";
itemList += "GI45S PLX745S O7002D O1070A1CS MT6601 75445 ";
itemList += "2-856029 1-709039 163070 160043 109380 811022 811001 811020 JXF5F45JU2S60X JS92M9A1M ";
itemList += "011608204 013461605 035208218 051462490 80888 84012 84364 84522 84522 60102 ";
itemList += "1895SBL 70822 XS7-243 82502 83620 ";
itemList += "3108929250 66822 47579 3868929230 98541 98521 3835980240 3848950260 ";
itemList += "XD9661HCSP XDM9201HCSP XD9649HCSP06 AOM150 KP3833 PM9093A 50485 52263 85330 27542 "; 



//Ruger = 3
itemList += "3313 3301 5902-RUG "; 

//tvshow videos
itemList += "1-738039 WAP10001 75404 "; //week 1
itemList += "1-191101ALR 108282 CIT45FSP R100 AA9626 "; // week 2
itemList += "3088929022 5077 PA4591219PGM 50420 534154140 "; //week 3
itemList += "1240 70PSS 811033 37001 55340 "; // week 4
itemList += "R92-56008 NV-455 1895-COWBOY 41010 PG-22502-03 "; // week 5
itemList += "P90TH PI-21502-03 3868929120 47577 3108929100 "; // week 6
itemList += "M85SS2UL 5401 53830 103038 DXT22LR3O "; // week 7
itemList += "1-247409P-15 P95PR15 PI-19502-03 66822 031539246 "; //week 8
itemList += "82500 011601204 SA08S1228PGM 56420 178025 "; // week 9

//*********************************** tv show *******************************
//TV Show
var initDate = new Date();
var curDate = initDate.getDate();
var curMonth = initDate.getMonth() + 1;
var curYear = initDate.getFullYear();
var curHour = initDate.getHours();
var curUTCHour = initDate.getUTCHours() ;

//week10 - 08/30 
    if ((curMonth == 8 && curDate == 30 && curUTCHour >= 22) || (curMonth == 8 && curDate > 30))
    {
    itemList += "035200226 7124 VGW306SR4O XL7-3006 51482 ";
}

//week11 - 09/06 
    if ((curMonth == 9 && curDate == 6 && curUTCHour >= 22) || (curMonth == 9 && curDate > 6))
    {
    itemList += "2-990069 P512MKIII WAP22003 051415490 TTRXAS  ";
}


//week12 - 09/13 
    if ((curMonth == 9 && curDate == 13 && curUTCHour >= 22) || (curMonth == 9 && curDate > 13))
    {
    //itemList += "5902-RUG 98521 BCWA3F-16M4 ARLB0019/PS/N" xxxxxxxx ";
}

//week13 - 09/20 
    if ((curMonth == 9 && curDate == 20 && curUTCHour >= 22) || (curMonth == 9 && curDate > 20))
    {
    //itemList += "85633 27487 HWK97101P+ 18115 XDM9389BHC ";
}

//************************ end of list of video item# ********************************









// **************************** DON NOT CHANGE BELOW ****************************
// ****************************************************************************
// **************************** used for Genie-Video links ****************************
var divX;
var divY;
//var vboxTop;


function displayVideoImage(itemID,viewType) {
    var lineHeight = "&nbsp";
    var itemCompareID = " " + itemID + " ";
    var aPosition = itemList.indexOf(itemCompareID);
	var bPosition = itemList.indexOf(itemCompareID,aPosition+2);
	
    if (aPosition != -1) {
        document.write('<span style="color:#cc0000; cursor:pointer;" ');
        document.write('onmouseout="document.onmousemove = null"  ');
        document.write('onmouseover=showVideoList("'+itemID+'","'+viewType+'") >');
        document.write('<img src="../imagesgog/icon-video.gif" alt="Click to watch a video about this gun" style="cursor:pointer"> ');
        document.write('</span>');         

    }    
    else {
       if (viewType != "ListView") {
            document.write("(No Video)");
       }
       else {
            document.write('<span style="color:#cc0000; text-align:center" colspan="2">&nbsp;</span>');
       }
    }                    
}


 
function showVideoList(itemID,viewType) {
    //get mouseposition
	 document.onmousemove = function (e) { 
	    e = e || window.event;
	    if (e.pageX || e.pageY) {
            x = e.pageX;
            y = e.pageY;
	    } 
        else {
            var de = document.documentElement;
            var b = document.body;
            x = e.clientX + 
                (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
            y = e.clientY + 
                (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
        }

      divX = 210; // left x-340; 220
	  divY = y-255; // top 150    
      
     if (viewType == "ListView" || viewType == "ItemDetail") {
        divX = 210;
        divY = y-150;
     }
     else if (viewType == "DetailView") {
        divX = 150;
        divY = y-255;
     }
    else {
        divX = 150;
        divY = y-255;
     }

    
    //alert("left=" + x + "; top=" + y);
 
    document.getElementById("VideoListDiv").style.display = "block";;
    document.getElementById("VideoListDiv").style.position="absolute";
    document.getElementById("VideoListDiv").style.left = divX + "px"; 
    document.getElementById("VideoListDiv").style.top = divY + "px"; 
    document.onmousemove = null;
    document.getElementById("VideoListFrame").src="../video/VideoListPopupBox.aspx?itemID="+itemID+"&divY="+divY;    
    }
}
   
// scrolling


   
    
function hideVideoListDiv() {
    parent.document.getElementById("VideoListDiv").style.display ="none";    
    parent.document.getElementById("VideoListFrame").src="../video/VideoListLoading.aspx";

}  
    
function playGenieVideo(itemID,VideoSource,divY) {
    parent.document.getElementById("genieVideoBox").style.display="block";           
    parent.document.getElementById("videoFrame").src="http://video.galleryofguns.com/video/vhPlayGenieVideo.aspx?itemID="+itemID+"&VideoSource="+VideoSource;
    //alert(divY);
    if (divY >= 500) {
        var videoFrameTop = divY-300;
        parent.document.getElementById("genieVideoBox").style.left = "35px"; //left
        parent.document.getElementById("genieVideoBox").style.top = videoFrameTop + "px"; //top
        parent.document.getElementById("genieVideoBox").scrollIntoView(true);	    
    }
    else {
        var videoFrameTop = 40;    
        parent.document.getElementById("genieVideoBox").style.left = "35px"; //left
        parent.document.getElementById("genieVideoBox").style.top = videoFrameTop + "px"; //top
    }
}

function closeGenieVideoBox() {
    document.getElementById("genieVideoBox").style.display="none";
    document.getElementById("videoFrame").src="";
}

//****************************************************
//****************************************************