function getUrlVars() {
	    var vars = {};
	    var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
	        vars[key] = value;
	    });
	    return vars;
	}


function callVideo(VidID){

		if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
  	
		var xmlhttp;
		xmlhttp = new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  
	}
	
	xmlhttp.open("GET","http://www.markertek.com/xml/video.xml",false);
	
	xmlhttp.send(null);
	xmlDoc=xmlhttp.responseXML;

	var totalCount= xmlDoc.getElementsByTagName("item").length;
	var x=xmlDoc.getElementsByTagName("item");
	for (i=0;i<totalCount;i++)
	  {
	       if(i==VidID){
	 	document.write('<object width="560" height="340"><param name="movie" value="http://www.youtube.com/v/');
			  	 document.write(x[i].getElementsByTagName("description")[0].childNodes[0].nodeValue);
				 document.write('&hl=en_US&fs=1?rel=0"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/');
				 document.write(x[i].getElementsByTagName("description")[0].childNodes[0].nodeValue);
				 document.write('&hl=en_US&fs=1?rel=0" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="560" height="340"></embed></object>');
				 
			document.write("<br /><br />");
			
			
			}
		
		 
	  	  


	
	  }
	

}

function callEven(){

		if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
  	
		var xmlhttp;
		xmlhttp = new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  
	}
	
	xmlhttp.open("GET","http://www.markertek.com/xml/video.xml",false);
	
	xmlhttp.send(null);
	xmlDoc=xmlhttp.responseXML;

	
	var x=xmlDoc.getElementsByTagName("item");
	for (i=0;i<100;i++)
	  {
	       
	 	
			if (i%2 == 0){

			document.write('<div id="left-layout-section">');
			
			document.write('<img class="layout-image" src="http://i.ytimg.com/vi/');
				document.write(x[i].getElementsByTagName("description")[0].childNodes[0].nodeValue);
			document.write('/default.jpg?w=120&h=90&sigh=xhKKStWLM_DtHo1moxV45dco5mk" onmouseover="this.style.cursor='); document.write("'pointer'"); document.write('" onclick="MM_openBrWindow'); document.write("('video-player.asp?vidID=");
				document.write(i);
			document.write("','video','resizable=yes,width=600,height=550')"); document.write('"alt="video" width="120" height="90" style="border:0;" /></a>');
			
			document.write('<img src="Images/logos/MTK-Logo_167.gif" /><br />');

			
			document.write('<a class="video-title" onmouseover="this.style.cursor='); document.write("'pointer'"); document.write('" onclick="MM_openBrWindow'); document.write("('video-player.asp?vidID="); 
			document.write(i);
			document.write("','video','resizable=yes,width=600,height=550')"); document.write('"alt="video" width="120" height="90" style="border:0;">');
				document.write(x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue);
			document.write('</a>');
			
			document.write('</div>');
			document.write('<br />');
				}
				
			
		 
	  	  


	
	  }
	

}

function callOdd(){

		if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
  	
		var xmlhttp;
		xmlhttp = new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  
	}
	
	xmlhttp.open("GET","http://www.markertek.com/xml/video.xml",false);
	
	xmlhttp.send(null);
	xmlDoc=xmlhttp.responseXML;

	
	var x=xmlDoc.getElementsByTagName("item");
	for (i=0;i<100;i++)
	  {
	       
	 	
			if (i%2 != 0){
			
			document.write('<div id="right-layout-section">');
			
			document.write('<img class="layout-image" src="http://i.ytimg.com/vi/');
				document.write(x[i].getElementsByTagName("description")[0].childNodes[0].nodeValue);
			document.write('/default.jpg?w=120&h=90&sigh=xhKKStWLM_DtHo1moxV45dco5mk" onmouseover="this.style.cursor='); document.write("'pointer'"); document.write('" onclick="MM_openBrWindow'); document.write("('video-player.asp?vidID=");
				document.write(i);
			document.write("','video','resizable=yes,width=600,height=550')"); document.write('"alt="video" width="120" height="90" style="border:0;" /></a>');
			
			document.write('<img src="Images/logos/MTK-Logo_167.gif" /><br />');
			
			document.write('<a class="video-title" onmouseover="this.style.cursor='); document.write("'pointer'"); document.write('" onclick="MM_openBrWindow'); document.write("('video-player.asp?vidID="); 
			document.write(i);
			document.write("','video','resizable=yes,width=600,height=550')"); document.write('"alt="video" width="120" height="90" style="border:0;">');
				document.write(x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue);
			document.write('</a>');
			
			document.write('</div>');
			document.write('<br />');
			
			
		
				}
				
			
		 
	  	  


	
	  }
	
}
function callTitle(VidID){

		if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
  	
		var xmlhttp;
		xmlhttp = new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  
	}
	
	xmlhttp.open("GET","http://www.markertek.com/xml/video.xml",false);
	
	xmlhttp.send(null);
	xmlDoc=xmlhttp.responseXML;

	var totalCount= xmlDoc.getElementsByTagName("item").length;
	var x=xmlDoc.getElementsByTagName("item");
	for (i=0;i<totalCount;i++)
	  {
	       if(i==VidID){
	 	document.write('<title>');
			  	 document.write(x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue);
				 document.write('</title>');
			
			
			}
		}	
}

function callProduct(VidID){

		if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
  	
		var xmlhttp;
		xmlhttp = new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  
	}
	
	xmlhttp.open("GET","http://www.markertek.com/xml/video.xml",false);
	
	xmlhttp.send(null);
	xmlDoc=xmlhttp.responseXML;

	var totalCount= xmlDoc.getElementsByTagName("item").length;
	var x=xmlDoc.getElementsByTagName("item");
	for (i=0;i<totalCount;i++)
	  {
	       if(i==VidID){
	 	document.write('<a href="');
			  	 document.write(x[i].getElementsByTagName("link")[0].childNodes[0].nodeValue);
				 document.write('" target="_blank"><span class="VideoPlayerLinks">View Product Page</span></a>');
			
			
			}
		}	

}

function callWeeklyVid(){

		if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
  	
		var xmlhttp;
		xmlhttp = new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  
	}
	
	xmlhttp.open("GET","http://www.markertek.com/xml/video.xml",false);
	
	xmlhttp.send(null);
	xmlDoc=xmlhttp.responseXML;

	
	var x=xmlDoc.getElementsByTagName("item");
	for (i=0;i<1;i++)
	  {
	       
	 	document.write('<p><span class="ShippingEstimatorTitle"><em>Markertek Video of the Week:</em></span><br /><iframe title="YouTube video player" width="365" height="235" src="http://www.youtube.com/embed/');
					  
					  document.write(x[i].getElementsByTagName("description")[0].childNodes[0].nodeValue);
					  document.write('?rel=0" frameborder="0" allowfullscreen></iframe><p><a href="http://www.markertek.com/new-items.xhtml" target="_blank"><img src="http://www.markertek.com/images/news/Top100_Blue.jpg" alt="Top 100" width="365" height="133" border="0" align="absmiddle" /></a><br></p>');
					
			  	 
				 
			
			
			}
		
		 
	  	  


	
}
	
function callDivChanges(pageNum,pageCount){

		count1=(pageNum*100);
		count2=(count1+100);
	if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
  	
		var xmlhttp;
		xmlhttp = new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  
	}
	
	xmlhttp.open("GET","http://www.markertek.com/xml/video.xml",false);
	
	xmlhttp.send(null);
	xmlDoc=xmlhttp.responseXML;
	leftStr="";
	rightStr="";
	var totalCount= xmlDoc.getElementsByTagName("item").length;
	var x=xmlDoc.getElementsByTagName("item");
	if (count2 > totalCount) { count2=totalCount; }
	
	pageNum++;
	for (j=0;j<pageCount;j++)
		{
			pageNumStr2= j+1;
			pageNumStr = "pages";
			pageNumStr = pageNumStr.concat(pageNumStr2);
			
				if (pageNum==(j+1)){
				document.getElementById(pageNumStr).style["color"] = "red";
				}
				else
				{
				document.getElementById(pageNumStr).style["color"] = "#003399";
				}
		}
		
	
	for (i=count1;i<count2;i++)
	  {
	       
	 	
			if (i%2 == 0){

			string1='<div id="left-layout-section">';
			
			string2='<img class="layout-image" src="http://i.ytimg.com/vi/';
			string3=x[i].getElementsByTagName("description")[0].childNodes[0].nodeValue;
			string4='/default.jpg?w=120&h=90&sigh=xhKKStWLM_DtHo1moxV45dco5mk" onmouseover="this.style.cursor=';
			string5="'pointer'"; 
			string6='" onclick="MM_openBrWindow';
			string7="('video-player.asp?vidID=";
			string8=i;
			string9="','video','resizable=yes,width=600,height=550')";
			string10='"alt="video" width="120" height="90" style="border:0;" /></a>';
			string10a='<img src="Images/logos/MTK-Logo_167.gif" /><br />';
			string11='<a class="video-title" onmouseover="this.style.cursor='
			string12="'pointer'";
			string13='" onclick="MM_openBrWindow';
			string14="('video-player.asp?vidID=";
			string15=i;
			string16="','video','resizable=yes,width=600,height=550')";
			string17='"alt="video" width="120" height="90" style="border:0;">';
			string18=x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue;
			string19='</a>';
			
			string20='</div><br />';
			
			
			
			leftStr = leftStr.concat(string1,string2,string3,string4,string5,string6,string7,string8,string9,string10,string10a,string11,string12,string13,string14,string15,string16,string17,string18,string19,string20);	
				}
				
			if(i%2 != 0){
			
			string1='<div id="right-layout-section">';
			
			string2='<img class="layout-image" src="http://i.ytimg.com/vi/';
			string3=x[i].getElementsByTagName("description")[0].childNodes[0].nodeValue;
			string4='/default.jpg?w=120&h=90&sigh=xhKKStWLM_DtHo1moxV45dco5mk" onmouseover="this.style.cursor=';
			string5="'pointer'"; 
			string6='" onclick="MM_openBrWindow';
			string7="('video-player.asp?vidID=";
			string8=i;
			string9="','video','resizable=yes,width=600,height=550')";
			string10='"alt="video" width="120" height="90" style="border:0;" /></a>';
			string10a='<img src="Images/logos/MTK-Logo_167.gif" /><br />';
			string11='<a class="video-title" onmouseover="this.style.cursor=';
			string12="'pointer'";
			string13='" onclick="MM_openBrWindow';
			string14="('video-player.asp?vidID=";
			string15=i;
			string16="','video','resizable=yes,width=600,height=550')";
			string17='"alt="video" width="120" height="90" style="border:0;">';
			string18=x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue;
			string19='</a>';
			
			string20='</div><br />';
			
			
			
			rightStr = rightStr.concat(string1,string2,string3,string4,string5,string6,string7,string8,string9,string10,string10a,string11,string12,string13,string14,string15,string16,string17,string18,string19,string20);	
				}
		}
			
	document.getElementById("left-image-layout").innerHTML=leftStr;
	document.getElementById("right-image-layout").innerHTML=rightStr;
	
}

function callPages(pageNums){

		if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
  	
		var xmlhttp;
		xmlhttp = new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  
	}
	
	xmlhttp.open("GET","http://www.markertek.com/xml/video.xml",false);
	
	xmlhttp.send(null);
	xmlDoc=xmlhttp.responseXML;
	
	var vidCount= xmlDoc.getElementsByTagName("item").length;
	
	if(vidCount%pageNums == 0){
		var pageCount = vidCount/pageNums;
	}
	else{
		var pageCount = Math.ceil(vidCount/pageNums);
	}


	
	
		document.write('<ul id="video-pages">');
		document.write('<li>Pages:</li>');
	for (i=0;i<(pageCount);i++) 
	{
		document.write('<li><a id="pages'); document.write(i+1); document.write('" href="javascript:callDivChanges('); document.write(i); document.write(','); document.write(pageCount); document.write(')">'); document.write(i+1); document.write('</a></li>');
		
	}

	document.write('</ul>');
	
	
	  
	
	
}


function callWeeklyVidHomePage(){

		if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
  	
		var xmlhttp;
		xmlhttp = new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  
	}
	var myurl="http://www.markertek.com/xml/video.xml";
	
	xmlhttp.open("GET",myurl,false);
	
	xmlhttp.send(null);
	xmlDoc=xmlhttp.responseXML;

	var newStr, testLength;
	var x=xmlDoc.getElementsByTagName("item");
	for (i=0;i<1;i++)
	  {
	       
	 	

				newStr=x[i].getElementsByTagName("title")[0].childNodes[0].nodeValue;
				
				document.write(newStr);
				
			  	 
				 
			
			
			}
		
		 
	  	  


	
}


function callWeeklyVidHomePageButton(){

		if (window.XMLHttpRequest)
	  {// code for IE7+, Firefox, Chrome, Opera, Safari
  	
		var xmlhttp;
		xmlhttp = new XMLHttpRequest();
	  }
	else
	  {// code for IE6, IE5
	  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
  
	}
	
	xmlhttp.open("GET","http://www.markertek.com/xml/video.xml",false);
	
	xmlhttp.send(null);
	xmlDoc=xmlhttp.responseXML;

	
	var x=xmlDoc.getElementsByTagName("item");
	for (i=0;i<1;i++)
	  {
	       
	 	
			document.write('<img src="images/Buttons/play-button.gif" onmouseover="this.style.cursor='); document.write("'pointer'"); document.write('" onclick="MM_openBrWindow'); document.write("('video-player.asp?vidID=");
				document.write(i);
			document.write("','video','resizable=yes,width=600,height=550')"); document.write('"alt="Play Button" width="48" height="30" border="0" /></a>');
			  	 
				
			
			
			}
		
		 
	  	  


	
}	

