var preEl;
var orgBColor;
var orgTColor;

function PinTrestCall() 
{
    window.PinIt = window.PinIt || { loaded:false };
    if (window.PinIt.loaded) return;
    window.PinIt.loaded = true;
    function async_load(){
        var s = document.createElement("script");
        s.type = "text/javascript";
        s.async = true;
        s.src = "http://assets.pinterest.com/js/pinit.js";
        var x = document.getElementsByTagName("script")[0];
        x.parentNode.insertBefore(s, x);
    }
    if (window.attachEvent)
        window.attachEvent("onload", async_load);
    else
        window.addEventListener("load", async_load, false);
}


function HighLightTR(el, backColor,textColor)
{
  if(typeof(preEl)!='undefined') 
  {
  preEl.bgColor=orgBColor;
  try{ChangeTextColor(preEl,orgTColor);}catch(e){;}
  }
orgBColor = el.bgColor;
orgTColor = el.style.color;
el.bgColor=backColor;

try{ChangeTextColor(el,textColor);}catch(e){;}
preEl = el;
}

function ShowTab(TabName)
{
//alert(TabName);

//document.getElementById(TabName).style.display = 'none';	
//document.getElementById(TabName).style.visibility = "hidden";

TabContentName=TabName+'Content';
TabTabName=TabName+'Tab';
var MyTabs=new Array("SizeColor","Features","Like");
var len = MyTabs.length;

for (var i = 0; i < len; i++)
  {
  TabContentName=MyTabs[i]+'Content';
	TabTabName=TabName+'Tab';	
  	if(MyTabs[i]!=TabName)
  		{
  		//alert(MyTabs[i]);
  		
			document.getElementById(TabContentName).style.visibility = 'hidden';
			document.getElementById(TabTabName).className = 'TabbedPanelsTab2';
			
  		}
  	else
  		{
  		//document.getElementById(TabTabName).className = 'TabbedPanelsTabGroup2';
  		document.getElementById(TabContentName).style.visibility = "visible";	
  		}
  }

//document.getElementById('SizeColorTab').style.visibility = 'hidden';
//document.getElementById('LikeTab').style.visibility = 'hidden';

//document.getElementById(TabTabName).className = 'SelectedTab';
//document.getElementById(TabContentName).style.visibility = "visible";

}

function ShowQuickView(PassedStyle,PassedColor)
{

document.getElementById('QuickViewProdPge').innerHTML = '<table ><tr  height=\"400\"><td align=\"center\" valign=\"right\" width=\"529\"><img src='+SITE+'/images/big-roller.gif></td></tr></table>';
script = document.createElement( 'script' );
PageSource=SECURESITE+'phpscripts/ProductHandler.php?action=QuickViewAlsoLike&Style='+PassedStyle+'&Color='+PassedColor;
script.src = PageSource;
document.getElementsByTagName( 'head' )[0].appendChild( script );	
}

function CloseQuickView()
{
document.getElementById('QuickViewProdPge').innerHTML = '';
}

function YouMightAlsoLike(Collection,CurStyle)
{
script = document.createElement( 'script' );
PageSource=SECURESITE+'phpscripts/ProductHandler.php?action=YouMightAlsoLike&Collection='+Collection+'&Style='+CurStyle;
script.src = PageSource;
document.getElementsByTagName( 'head' )[0].appendChild( script );	
}

function ChangeTextColor(a_obj,a_color)
{  
for (i=0;i<a_obj.cells.length;i++)
   a_obj.cells(i).style.color=a_color;
}

function UpdateSize(Size)
{
//alert(Size);
document.getElementById('CurrentSize').innerHTML =Size;
}


function GetOtherView(ImgLoc,Constraint,ColorCode,Gender,Style,SelectedView)
{
ClickEvent='onclick=openPopWin(\'http://www.clogscentral.com/phpscripts/OtherViewPop.php?ColorCode='+ColorCode+'&Style='+Style+'&Gender='+Gender+'&View='+SelectedView+'\',550,750,\'resizable,menubar\',0,0);';	
//alert(ImgLoc);
$NewImage='<a href=#><img src='+ImgLoc+' '+Constraint+' '+ClickEvent+' border=0></a>';
document.getElementById('ImgSwap').innerHTML = $NewImage;
}

function SwapView(ColorCode,Style,Gender,View,ColorDesc)
{	
script = document.createElement( 'script' );
script.src ='http://www.clogscentral.com/phpscripts/ProductHandler.php?action=GetNewViewPic&ColorCode='+ColorCode+'&Style='+Style+'&Gender='+Gender+'&View='+View;
//alert('hello');
document.getElementsByTagName( 'head' )[0].appendChild( script );
}

function movepic(img_name,img_src) {
//window.document.images['ImgSwapper'].src=img_src;
}

function whichElement(event)
{


}

function toggleview(itm)
{
   var itmx = document.getElementById(itm);
   if (itmx.style.display == "none")
   {
      itmx.style.display = "block";
   }
   else
   {
      itmx.style.display = "none";
   }
}


function QuickSearch(SearchTxt,MyForm)
{
script = document.createElement( 'script' );
PageSource='https://www.clogscentral.com/phpscripts/ProductHandler.php?action=QuickSearch&SearchTxt='+SearchTxt;
script.src = PageSource;
document.getElementsByTagName( 'head' )[0].appendChild( script );
//document.getElementById('MenuBar1').innerHTML="";
}

function QuickSearchClear()
{
document.getElementById('SearchResults').innerHTML = '';
//document.getElementById('MenuBar1').innerHTML='<li><a class="MenuBarItemSubmenu" href="http://www.fleecefootwear.com/New-Uggs.html">NEW</a><ul><li><a href="http://www.fleecefootwear.com/New-Uggs.html#boots">UGG Boots</a></li><li><a href="http://www.fleecefootwear.com/New-Uggs.html#slippers">UGG Slippers</a></li><li><a href="http://www.fleecefootwear.com/New-Uggs.html#shoes">UGG Shoes</a></li><li><a href="http://www.fleecefootwear.com/New-Uggs.html#sandals">UGG Sandals</a></li></ul></li><li><a href="http://www.fleecefootwear.com/Ugg-womens/" class="MenuBarItemSubmenu">WOMEN</a><ul><li><a href="http://www.fleecefootwear.com/Ugg-womens/boots/">UGG Boots</a></li><li><a href="http://www.fleecefootwear.com/Ugg-womens/slippers/">UGG Slippers</a></li><li><a href="http://www.fleecefootwear.com/Ugg-womens/shoes/">UGG Shoes</a></li><li><a href="http://www.fleecefootwear.com/Ugg-womens/sandals/">UGG Sandals</a></li><li><a href="http://www.fleecefootwear.com/Ugg-handbags/">UGG Accessories</a></li></ul></li><li><a class="MenuBarItemSubmenu" href="http://www.fleecefootwear.com/Ugg-mens/">MEN</a><ul><li><a href="http://www.fleecefootwear.com/Ugg-mens/boots/">UGG Boots</a></li><li><a href="http://www.fleecefootwear.com/Ugg-mens/slippers/">UGG Slippers</a></li><li><a href="http://www.fleecefootwear.com/Ugg-mens/shoes/">UGG Shoes</a></li></ul></li><li><a href="http://www.fleecefootwear.com/Ugg-kids/">KIDS</a></li><li><a href="#" class="MenuBarItemSubmenu"><rednav>SALE</rednav></a><ul><li><a href="http://www.fleecefootwear.com/Ugg-womens/Sale.html"><font size="-1">Womens Sale UGG</font></a></li><li><a href="http://www.fleecefootwear.com/Ugg-mens/Sale.html"><font size="-1">Mens Sale UGG</font></a></li></ul></li>';
}

function CheckthatItemWasSelected(NumItems)
{
var Flag=0;
var alertText;
	for(i=0; i<document.forms[1].elements.length; i++){
     if(document.forms[1].elements[i].type == "checkbox")
     	{
     	if(document.forms[1].elements[i].checked)
      	Flag=1;
      }
   }  
if(Flag == 1)
	{
	document.forms[1].submit();
	}
else
	{
	ErrorMessage='Please check item you want to return before continuing.';
	alert(ErrorMessage);
	}	
}

function OrderByName(SelectedItem,Cat,Gender,CurSearchGroup)
{
Relocation = 'http://www.clogscentral.com/phpscripts/ProductHandler.php?action=OrderByName&Ordering='+SelectedItem+'&Cat='+Cat+'&Gender='+Gender+'&CurSearchGroup='+CurSearchGroup;
window.location=Relocation;
}

function OrderByPrice(SelectedItem,Cat,Gender)
{
Relocation = 'http://www.clogscentral.com/phpscripts/ProductHandler.php?action=OrderByPrice&Ordering='+SelectedItem+'&Cat='+Cat+'&Gender='+Gender;
window.location=Relocation;
}

function GetColorBySubCat(SelectedItem,Cat,Gender,CurSearchGroup)
{
Relocation = 'http://www.clogscentral.com/phpscripts/ProductHandler.php?action=GetColorBySubCat&Ordering=Color&ColorType='+SelectedItem+'&Cat='+Cat+'&Gender='+Gender+'&CurSearchGroup='+CurSearchGroup;
window.location=Relocation;
}

function GetAvailSizesBySubCat(SelectedItem,Cat,Gender)
{
Relocation = 'http://www.clogscentral.com/phpscripts/ProductHandler.php?action=GetAvailSizesBySubCat&Ordering=Size&Size='+SelectedItem+'&Cat='+Cat+'&Gender='+Gender;
window.location=Relocation;
}

function OrderByPriceNoCat(SelectedItem,CurSearchGroup,Gender,CurSelStyle)
{
Relocation = 'http://www.clogscentral.com/phpscripts/ProductHandler.php?action=OrderByPriceNoCat&Ordering='+SelectedItem+'&CurSearchGroup='+CurSearchGroup+'&Gender='+Gender+'&CurSelStyle='+CurSelStyle;
window.location=Relocation;
}

function CheckReturnForm(MyForm)
{
//Go through each item to make sure return reason is selected
NumItems=MyForm.NumItems.value;
Count=1;
ErrorMessage='';
while(Count<=NumItems)
	{
	varname='RetCode'+Count;
	RetCode=eval('document.ReturnForm.'+varname+'.options[document.ReturnForm.RetCode'+Count+'.options.selectedIndex].value');
	if(RetCode=='')
		{
		//alert(RetCode);
		document.getElementById(varname).className = 'redTD';
		ErrorMessage+='Please select a reason for item '+Count+' of your return.\n';
		}	
	Count++;
	}

OrderNum=document.ReturnForm.OrderNumber.value

var d = new Date();
var curr_date = d.getDate();
var curr_month = d.getMonth();
var curr_year = d.getFullYear();
CardType='';
	if(MyForm.CardType[0].checked)
		CardType='Visa';
	if(MyForm.CardType[1].checked)
		CardType='MasterCard';
	if(MyForm.CardType[2].checked)
		CardType='Discover';
	if(MyForm.CardType[3].checked)
		CardType='AmExpress';
		
	if(CardType =='')
		{
		document.getElementById('CardTypes').className = 'redTD';
		ErrorMessage+='Please Choose Card Type\n';
		}
	CCNum1=MyForm.CCNum1.value;
	if(CCNum1 == '')
		{
		document.getElementById('CardNum').className = 'redTD';
		ErrorMessage+='Please Fill in Card Box 1\n';
		}
	CCNum2=MyForm.CCNum2.value;	
	if(CCNum2 == '')
		{
		document.getElementById('CardNum').className = 'redTD';
		ErrorMessage+='Please Fill in Card Box 2\n';
		}
	CCNum3=MyForm.CCNum3.value;	
	if(CCNum3 == '')
		{
		document.getElementById('CardNum').className = 'redTD';
		ErrorMessage+='Please Fill in Card Box 3\n';
		}
	CCNum4=MyForm.CCNum4.value;	
	if(CCNum4 == '')
		{
		document.getElementById('CardNum').className = 'redTD';
		ErrorMessage+='Please Fill in Card Box 4\n';
		}
	Last4=MyForm.CCNum4.value;
		
	FullCCNum=CCNum1+CCNum2+CCNum3+CCNum4;
	CVV2=MyForm.CVV2.value;	
	if(CVV2 == '')
		{
		document.getElementById('CVV2Num').className = 'redTD';
		ErrorMessage+='Please Fill in all cvv2\n';
		}
	MonthExp=MyForm.MonthExp.value;	
	YearExp=MyForm.YearExp.value;	
	if(MonthExp <= curr_month)
		{
		if(curr_year == YearExp)
			{
			document.getElementById('ExpireDate').className = 'redTD';
			ErrorMessage+='Please Use a Card that is not expired.\n';
			}
		}


FirstName=MyForm.FirstName.value;
LastName=MyForm.LastName.value;
Address=MyForm.Address.value;
City=MyForm.City.value;
State=MyForm.ShipState.value;
Zip=MyForm.Zip.value;
if(FirstName == '')
	{
	document.getElementById('ShipFirstName').className = 'redTD';
	ErrorMessage+='Please enter First Name to continue.\n';
	}	
if(LastName == '')
	{
	document.getElementById('ShipLastName').className = 'redTD';
	ErrorMessage+='Please enter Last Name to continue.\n';
	}	
if(Address == '')
	{
	document.getElementById('ShipAddress').className = 'redTD';
	ErrorMessage+='Please enter Address to continue.\n';
	}	
if(City == '')
	{
	document.getElementById('ShipCity').className = 'redTD';
	ErrorMessage+='Please enter City to continue.\n';
	}	
if(State == '')
	{
	document.getElementById('ShipState').className = 'redTD';
	ErrorMessage+='Please Choose state before continuing.\n';
	}	
if(Zip == '')
	{
	document.getElementById('ShipZip').className = 'redTD';
	ErrorMessage+='Please enter Zip to continue.\n';
	}	
if(ErrorMessage == '')
	{
	MyForm.submit();
	}
else
	{
	alert(ErrorMessage);
	}
}

function CheckAddieForm(MyForm)
{
ErrorMessage='';
FirstName=MyForm.BillFirstName.value;
if(FirstName == '')
	{
	document.getElementById('BillFirstName').className = 'redTD';
	ErrorMessage+='Please enter first name.\n';
	}	
LastName=MyForm.BillLastName.value;
if(LastName == '')
	{
	document.getElementById('BillLastName').className = 'redTD';
	ErrorMessage+='Please enter last name.\n';
	}	
Address=MyForm.BillAddress.value;
if(Address == '')
	{
	document.getElementById('BillAddress').className = 'redTD';
	ErrorMessage+='Please enter address.\n';
	}	
City=MyForm.BillCity.value;
if(City == '')
	{
	document.getElementById('BillCity').className = 'redTD';
	ErrorMessage+='Please enter city.\n';
	}
State=MyForm.BillState.value;
if(State == '')
	{
	document.getElementById('BillState').className = 'redTD';
	ErrorMessage+='Please enter state.\n';
	}
Zip=MyForm.BillZip.value;
if(Zip == '')
	{
	document.getElementById('BillZip').className = 'redTD';
	ErrorMessage+='Please enter zip.\n';
	}
Phone=MyForm.BillPhone.value;
if(Phone == '')
	{
	document.getElementById('BillPhone').className = 'redTD';
	ErrorMessage+='Please enter contact phone number.\n';
	}
if(ErrorMessage == '')
	{
	MyForm.submit();
	}
else
	{
	alert(ErrorMessage);
	}
}

function UpdateField(Field)
{
document.getElementById(Field).className = 'whiteTD';
}

function UpdateField2(Field)
{
document.getElementById(Field).className = 'whiteTD';
}

function CheckContactUsForm(MyForm)
{
ErrorMessage='';
Code=MyForm.Code.value;
if(Code != '123dansko')
	{
	//document.getElementById('Code').className = 'redTD';
	ErrorMessage+='Please Enter Correct Security Code\n';
	}	
if(ErrorMessage == '')
	{
	MyForm.submit();
	}
else
	{
	alert(ErrorMessage);
	}
}

function LoadStyleDropDown()
{
var url ='https://www.clogscentral.com/phpscripts/ProductHandler.php?action=LoadStyleDropDown';	
script = document.createElement( 'script' );
script.src = url;
document.getElementsByTagName( 'head' )[0].appendChild( script );		
}

function SizeSearch(Gender,Size)
{
if(document.getElementById('InvSizes'))
	{document.getElementById('InvSizes').innerHTML = "Please wait, getting all available sizes...";	}
var url ='http://www.clogscentral.com/phpscripts/AvailableSizeSearch.php?action=go&Gender='+Gender+'&Size='+Size;	
script = document.createElement( 'script' );
script.src = url;
document.getElementsByTagName( 'head' )[0].appendChild( script );	
}

function EmptyCart()
{
//script = document.createElement( 'script' );
//script.src = 'https://www.clogscentral.com/Checkout/CheckOut.php?action=EmptyCart';
//document.getElementsByTagName( 'head' )[0].appendChild( script );
Relocation = 'https://www.clogscentral.com/Checkout/CheckOut.php?action=EmptyCart';
window.location=Relocation;
}

function NewWindow(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) /1.1;
	var wint = (screen.height - h) / 5;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) {
		win.window.focus();
	}
}

function RecentlyViewed(SKU)
{
script = document.createElement( 'script' );
TheCall='http://www.clogscentral.com/phpscripts/RecentDisplay.php?SKU='+SKU;
script.src = TheCall;
document.getElementsByTagName( 'head' )[0].appendChild( script );	
}

function SwapColor(ColorCode,Style,ColorDesc,Gender,SubCat)
{

if(document.getElementById('ColorName'))
	{document.getElementById('ColorName').innerHTML = ColorDesc;}
//ProdN=Gender+' '+Style+' '+ColorDesc;
//document.getElementById('ProductName').innerHTML = ProdN;

GetAvailableSizes(ColorCode,Style,Gender,SubCat);
script = document.createElement( 'script' );
TheCall='http://www.clogscentral.com/phpscripts/ProductHandler.php?action=GetNewColorPic&ColorCode='+ColorCode+'&Style='+Style+'&Gender='+Gender+'&SubCatID='+SubCat;
//http://www.clogscentral.com/phpscripts/ProductHandler.php?action=GetNewColorPic&ColorCode=020200&Style=2323&Gender=WOMENS&SubCatID=78
//alert(TheCall);
script.src = TheCall;
document.getElementsByTagName( 'head' )[0].appendChild( script );
 
}

function GetSelectedColorName(ColorDesc)
{
document.getElementById('ColorName').innerHTML = ColorDesc;
}

function GetColorMini(ColorCode,Style,ColorDescription,Gender)
{
script = document.createElement( 'script' );
script.src = 'http://www.clogscentral.com/phpscripts/ProductHandler.php?action=GetNewColorPicMini&ColorCode='+ColorCode+'&Style='+Style+'&Gender='+Gender+'&DivID='+Style;
document.getElementsByTagName( 'head' )[0].appendChild( script );
}

function GetColorNameMini(Style,ColorDescription)
{
//DivColorName='Color'+Style;
//document.getElementById(DivColorName).innerHTML = ColorDescription;
}

function GetAvailableSizes(ColorCode,Style,Gender,SubCat)
{
//alert(Gender);
if(document.getElementById('AvailableSizes'))
	{document.getElementById('AvailableSizes').innerHTML = 'Please wait, loading available sizes...';}
script = document.createElement( 'script' );
TheCall='http://www.clogscentral.com/phpscripts/ProductHandler.php?action=AvailableSizes&ColorCode='+ColorCode+'&Style='+Style+'&Gender='+Gender+'&SubCatID='+SubCat;
//alert(TheCall);
script.src = TheCall;

document.getElementsByTagName( 'head' )[0].appendChild( script );
}

function LoadMiniCart()
{
script = document.createElement( 'script' );
script.src = 'http://www.clogscentral.com/NewCart/CartHandler.php?action=LoadMiniCart';
document.getElementsByTagName( 'head' )[0].appendChild( script );
}

function LoadRecentlyViewed(SKU)
{
script = document.createElement( 'script' );
script.src = 'http://www.clogscentral.com/phpscripts/RecentDisplay.php?SKU='+SKU;
document.getElementsByTagName( 'head' )[0].appendChild( script );
}

function SelectSize(SKU)
{
if(SKU != '')
	{document.getElementById('SelectedSize').innerHTML = '<input type=hidden id=UPC12digit name=sku value='+SKU+'>';}
script = document.createElement( 'script' );
script.src = 'http://www.clogscentral.com/phpscripts/ProductHandler.php?action=ShowFreeGiftBanner&sku='+SKU;
document.getElementsByTagName( 'head' )[0].appendChild( script );
}

var whosChanged = null;
function ChangeColor(el)
{
el.style.backgroundColor = "#FE3000";
el.style.color = "#000000";
if (whosChanged != null)
{
whosChanged.style.backgroundColor = ""
whosChanged.style.color = ""
}
whosChanged = el;
}

function AddToCart(Action)
{
	if(document.getElementById('UPC12digit'))
		{
		document.getElementById('superminicart').innerHTML = "<img src=\"http://www.clogscentral.com/images/AddingBag.jpg\">";
	  document.getElementById('ImgSwap').innerHTML = "<h1><font color=\"#138816\">Adding to cart...</font></h1>";
	
		var UPC12digit = document.getElementById('UPC12digit').value;		
		 //alert(UPC12digit);	
		var Qty = document.getElementById('Qty').value;	
		script = document.createElement( 'script' );
		script.src = 'http://www.clogscentral.com/NewCart/CartHandler.php?action='+Action+'&sku='+UPC12digit+'&Qty='+Qty;
		document.getElementsByTagName( 'head' )[0].appendChild( script );
		}
	else
		{
		alert('Please Choose a size.');
		}
}

function AddToCartWDiscount(MyAction,UPC12digit,Qty)
{

		document.getElementById('superminicart').innerHTML = "<img src=\"http://www.clogscentral.com/images/AddingBag.jpg\">";
	  //document.getElementById('ImgSwap').innerHTML = "<h1><font color=\"#138816\">Adding to cart...</font></h1>";
	
		
		//alert(UPC12digit);	
		
		//alert(Qty);	
		//alert(MyAction);
		script = document.createElement( 'script' );
		script.src = 'http://www.clogscentral.com/NewCart/CartHandler.php?action='+MyAction+'&sku='+UPC12digit+'&Qty='+Qty;
		document.getElementsByTagName( 'head' )[0].appendChild( script );

}

function AddToCartWOffer(Myaction,Curstyle,Gender)
{
	if(document.getElementById('UPC12digit'))
		{
		document.getElementById('superminicart').innerHTML = "<img src=\"http://www.clogscentral.com/images/AddingBag.jpg\">";
	  document.getElementById('ImgSwap').innerHTML = "<h1><font color=\"#138816\">Adding to cart...</font></h1>";
		
		var UPC12digit = document.getElementById('UPC12digit').value;		
		 //alert(UPC12digit);	
		var Qty = document.getElementById('Qty').value;	
		textArray[2]="<font face='Arial' size='3'><font size=2>Similar items in your size are currently discounted. <a href=http://www.clogscentral.com/phpscripts/ProductHandler.php?action=GetListOfIntockColors&Style="+Curstyle+"&UPC12digit="+UPC12digit+"&Gender="+Gender+">Click here</a> to see what is on sale...</font><br>"
		script = document.createElement( 'script' );
		script.src = 'http://www.clogscentral.com/NewCart/CartHandler.php?action='+Myaction+'&sku='+UPC12digit+'&Qty='+Qty;
		
		document.getElementsByTagName( 'head' )[0].appendChild( script );
		}
	else
		{
		alert('Please Choose a size.');
		}
}


function TrakIt(ThisSrc)
{
script = document.createElement( 'script' );
script.src = 'https://www.clogscentral.com/phpscripts/pagetraker.php?Page='+ThisSrc;
document.getElementsByTagName( 'head' )[0].appendChild( script );
}

function ChangeShipping(shipping)
{
document.getElementById('ShippingCost').innerHTML = 'Loading..';	
document.getElementById('GrandTotal').innerHTML = 'Loading..';	
script = document.createElement( 'script' );
Loc='https://www.clogscentral.com/Checkout/CheckOut2.php?action=ChangeShipping&ShippingType='+shipping;
//alert(Loc);
script.src = Loc;
document.getElementsByTagName( 'head' )[0].appendChild( script );
}

var popWin = null    // use this when referring to pop-up window
var winCount = 0
var winName = "popWin"

function openPopWin(winURL, winWidth, winHeight, winFeatures, winLeft, winTop){
  var d_winLeft = 20  // default, pixels from screen left to window left
  var d_winTop = 20   // default, pixels from screen top to window top
  winName = "popWin" + winCount++ //unique name for each pop-up window
  closePopWin()           // close any previously opened pop-up window
  if (openPopWin.arguments.length >= 4)  // any additional features?
    winFeatures = "," + winFeatures+',';
  else
    winFeatures = ""
  //window.open('jex5.htm','mywindow','width=400,height=200,left=0,top=100,screenX=0,screenY=100')
  if (openPopWin.arguments.length == 6)  // location specified
    winFeatures += 'width='+winWidth+',height='+ winHeight+',left='+ winLeft+',top='+ winTop;
  else
    winFeatures += 'width='+winWidth+',height='+ winHeight+',left='+d_winLeft+',top='+ d_winTop
  //alert(winFeatures);
  popWin = window.open(winURL, winName, winFeatures)
  }
  
  
function closePopWin(){    // close pop-up window if it is open
  if (navigator.appName != "Microsoft Internet Explorer"
      || parseInt(navigator.appVersion) >=4) //do not close if early IE
    if(popWin != null) if(!popWin.closed) popWin.close()
  }


function getLocation(winWidth, winHeight, winLeft, winTop){
  return ""
  }
  
  
ParseQuerystring();

function ParseQuerystring(qs) 
{ 
//alert('inside Parse');
// Using this function to grab query string and check for Commission Junction variable ref=cj
	this.params = {};
	if (qs == null) qs = location.search.substring(1, location.search.length);
	if (qs.length == 0) return;
	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] = value;
		//alert(name);
			if(name == 'ref' || name == 'PID')			
				{
				//Post Cookie
				//alert('posting cj cookie');
				var exdate=new Date();
				var c_name='ref';
				var expiredays=45;
				exdate.setDate(exdate.getDate()+expiredays);
				//Setting cookie for CJ to expire in 45 days
				document.cookie=c_name+ "=" +escape(value)+
				((expiredays==null) ? "" : ";expires="+exdate.toGMTString());
				//Track where visitor came from
				script = document.createElement( 'script' );
				//Loc='https://www.clogscentral.com/phpscripts/pagetraker2.php';
				Loc='https://www.clogscentral.com/phpscripts/pagetraker2.php?Page='+window.location+'&Referer='+document.referrer;
				//alert(Loc);
				script.src = Loc;
				document.getElementsByTagName( 'head' )[0].appendChild( script );	
				}			
			if(name == 'gclid')
				{
				//Track where visitor came from
				script = document.createElement( 'script' );
				//Loc='https://www.clogscentral.com/phpscripts/pagetraker2.php';
				Loc='https://www.clogscentral.com/phpscripts/pagetraker2.php?Page='+window.location+'&Referer='+document.referrer;
				//alert(Loc);
				script.src = Loc;
				document.getElementsByTagName( 'head' )[0].appendChild( script );		
				}
		}
}




// SpryTabbedPanels.js - version 0.7 - Spry Pre-Release 1.6.1
//
// Copyright (c) 2006. Adobe Systems Incorporated.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
//   * Redistributions of source code must retain the above copyright notice,
//     this list of conditions and the following disclaimer.
//   * Redistributions in binary form must reproduce the above copyright notice,
//     this list of conditions and the following disclaimer in the documentation
//     and/or other materials provided with the distribution.
//   * Neither the name of Adobe Systems Incorporated nor the names of its
//     contributors may be used to endorse or promote products derived from this
//     software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.

(function() { // BeginSpryComponent

if (typeof Spry == "undefined") window.Spry = {}; if (!Spry.Widget) Spry.Widget = {};

Spry.Widget.TabbedPanels = function(element, opts)
{
	this.element = this.getElement(element);
	this.defaultTab = 0; // Show the first panel by default.
	this.tabSelectedClass = "TabbedPanelsTabSelected";
	this.tabHoverClass = "TabbedPanelsTabHover";
	this.tabFocusedClass = "TabbedPanelsTabFocused";
	this.panelVisibleClass = "TabbedPanelsContentVisible";
	this.focusElement = null;
	this.hasFocus = false;
	this.currentTabIndex = 0;
	this.enableKeyboardNavigation = true;
	this.nextPanelKeyCode = Spry.Widget.TabbedPanels.KEY_RIGHT;
	this.previousPanelKeyCode = Spry.Widget.TabbedPanels.KEY_LEFT;

	Spry.Widget.TabbedPanels.setOptions(this, opts);

	// If the defaultTab is expressed as a number/index, convert
	// it to an element.

	if (typeof (this.defaultTab) == "number")
	{
		if (this.defaultTab < 0)
			this.defaultTab = 0;
		else
		{
			var count = this.getTabbedPanelCount();
			if (this.defaultTab >= count)
				this.defaultTab = (count > 1) ? (count - 1) : 0;
		}

		this.defaultTab = this.getTabs()[this.defaultTab];
	}

	// The defaultTab property is supposed to be the tab element for the tab content
	// to show by default. The caller is allowed to pass in the element itself or the
	// element's id, so we need to convert the current value to an element if necessary.

	if (this.defaultTab)
		this.defaultTab = this.getElement(this.defaultTab);

	this.attachBehaviors();
};

Spry.Widget.TabbedPanels.prototype.getElement = function(ele)
{
	if (ele && typeof ele == "string")
		return document.getElementById(ele);
	return ele;
};

Spry.Widget.TabbedPanels.prototype.getElementChildren = function(element)
{
	var children = [];
	var child = element.firstChild;
	while (child)
	{
		if (child.nodeType == 1 /* Node.ELEMENT_NODE */)
			children.push(child);
		child = child.nextSibling;
	}
	return children;
};

Spry.Widget.TabbedPanels.prototype.addClassName = function(ele, className)
{
	if (!ele || !className || (ele.className && ele.className.search(new RegExp("\\b" + className + "\\b")) != -1))
		return;
	ele.className += (ele.className ? " " : "") + className;
};

Spry.Widget.TabbedPanels.prototype.removeClassName = function(ele, className)
{
	if (!ele || !className || (ele.className && ele.className.search(new RegExp("\\b" + className + "\\b")) == -1))
		return;
	ele.className = ele.className.replace(new RegExp("\\s*\\b" + className + "\\b", "g"), "");
};

Spry.Widget.TabbedPanels.setOptions = function(obj, optionsObj, ignoreUndefinedProps)
{
	if (!optionsObj)
		return;
	for (var optionName in optionsObj)
	{
		if (ignoreUndefinedProps && optionsObj[optionName] == undefined)
			continue;
		obj[optionName] = optionsObj[optionName];
	}
};

Spry.Widget.TabbedPanels.prototype.getTabGroup = function()
{
	if (this.element)
	{
		var children = this.getElementChildren(this.element);
		if (children.length)
			return children[0];
	}
	return null;
};

Spry.Widget.TabbedPanels.prototype.getTabs = function()
{
	var tabs = [];
	var tg = this.getTabGroup();
	if (tg)
		tabs = this.getElementChildren(tg);
	return tabs;
};

Spry.Widget.TabbedPanels.prototype.getContentPanelGroup = function()
{
	if (this.element)
	{
		var children = this.getElementChildren(this.element);
		if (children.length > 1)
			return children[1];
	}
	return null;
};

Spry.Widget.TabbedPanels.prototype.getContentPanels = function()
{
	var panels = [];
	var pg = this.getContentPanelGroup();
	if (pg)
		panels = this.getElementChildren(pg);
	return panels;
};

Spry.Widget.TabbedPanels.prototype.getIndex = function(ele, arr)
{
	ele = this.getElement(ele);
	if (ele && arr && arr.length)
	{
		for (var i = 0; i < arr.length; i++)
		{
			if (ele == arr[i])
				return i;
		}
	}
	return -1;
};

Spry.Widget.TabbedPanels.prototype.getTabIndex = function(ele)
{
	var i = this.getIndex(ele, this.getTabs());
	if (i < 0)
		i = this.getIndex(ele, this.getContentPanels());
	return i;
};

Spry.Widget.TabbedPanels.prototype.getCurrentTabIndex = function()
{
	return this.currentTabIndex;
};

Spry.Widget.TabbedPanels.prototype.getTabbedPanelCount = function(ele)
{
	return Math.min(this.getTabs().length, this.getContentPanels().length);
};

Spry.Widget.TabbedPanels.addEventListener = function(element, eventType, handler, capture)
{
	try
	{
		if (element.addEventListener)
			element.addEventListener(eventType, handler, capture);
		else if (element.attachEvent)
			element.attachEvent("on" + eventType, handler);
	}
	catch (e) {}
};

Spry.Widget.TabbedPanels.prototype.cancelEvent = function(e)
{
	if (e.preventDefault) e.preventDefault();
	else e.returnValue = false;
	if (e.stopPropagation) e.stopPropagation();
	else e.cancelBubble = true;

	return false;
};

Spry.Widget.TabbedPanels.prototype.onTabClick = function(e, tab)
{
	this.showPanel(tab);
	return this.cancelEvent(e);
};

Spry.Widget.TabbedPanels.prototype.onTabMouseOver = function(e, tab)
{
	this.addClassName(tab, this.tabHoverClass);
	return false;
};

Spry.Widget.TabbedPanels.prototype.onTabMouseOut = function(e, tab)
{
	this.removeClassName(tab, this.tabHoverClass);
	return false;
};

Spry.Widget.TabbedPanels.prototype.onTabFocus = function(e, tab)
{
	this.hasFocus = true;
	this.addClassName(tab, this.tabFocusedClass);
	return false;
};

Spry.Widget.TabbedPanels.prototype.onTabBlur = function(e, tab)
{
	this.hasFocus = false;
	this.removeClassName(tab, this.tabFocusedClass);
	return false;
};

Spry.Widget.TabbedPanels.KEY_UP = 38;
Spry.Widget.TabbedPanels.KEY_DOWN = 40;
Spry.Widget.TabbedPanels.KEY_LEFT = 37;
Spry.Widget.TabbedPanels.KEY_RIGHT = 39;



Spry.Widget.TabbedPanels.prototype.onTabKeyDown = function(e, tab)
{
	var key = e.keyCode;
	if (!this.hasFocus || (key != this.previousPanelKeyCode && key != this.nextPanelKeyCode))
		return true;

	var tabs = this.getTabs();
	for (var i =0; i < tabs.length; i++)
		if (tabs[i] == tab)
		{
			var el = false;
			if (key == this.previousPanelKeyCode && i > 0)
				el = tabs[i-1];
			else if (key == this.nextPanelKeyCode && i < tabs.length-1)
				el = tabs[i+1];

			if (el)
			{
				this.showPanel(el);
				el.focus();
				break;
			}
		}

	return this.cancelEvent(e);
};

Spry.Widget.TabbedPanels.prototype.preorderTraversal = function(root, func)
{
	var stopTraversal = false;
	if (root)
	{
		stopTraversal = func(root);
		if (root.hasChildNodes())
		{
			var child = root.firstChild;
			while (!stopTraversal && child)
			{
				stopTraversal = this.preorderTraversal(child, func);
				try { child = child.nextSibling; } catch (e) { child = null; }
			}
		}
	}
	return stopTraversal;
};

Spry.Widget.TabbedPanels.prototype.addPanelEventListeners = function(tab, panel)
{
	var self = this;
	Spry.Widget.TabbedPanels.addEventListener(tab, "click", function(e) { return self.onTabClick(e, tab); }, false);
	Spry.Widget.TabbedPanels.addEventListener(tab, "mouseover", function(e) { return self.onTabMouseOver(e, tab); }, false);
	Spry.Widget.TabbedPanels.addEventListener(tab, "mouseout", function(e) { return self.onTabMouseOut(e, tab); }, false);

	if (this.enableKeyboardNavigation)
	{
		// XXX: IE doesn't allow the setting of tabindex dynamically. This means we can't
		// rely on adding the tabindex attribute if it is missing to enable keyboard navigation
		// by default.

		// Find the first element within the tab container that has a tabindex or the first
		// anchor tag.
		
		var tabIndexEle = null;
		var tabAnchorEle = null;

		this.preorderTraversal(tab, function(node) {
			if (node.nodeType == 1 /* NODE.ELEMENT_NODE */)
			{
				var tabIndexAttr = tab.attributes.getNamedItem("tabindex");
				if (tabIndexAttr)
				{
					tabIndexEle = node;
					return true;
				}
				if (!tabAnchorEle && node.nodeName.toLowerCase() == "a")
					tabAnchorEle = node;
			}
			return false;
		});

		if (tabIndexEle)
			this.focusElement = tabIndexEle;
		else if (tabAnchorEle)
			this.focusElement = tabAnchorEle;

		if (this.focusElement)
		{
			Spry.Widget.TabbedPanels.addEventListener(this.focusElement, "focus", function(e) { return self.onTabFocus(e, tab); }, false);
			Spry.Widget.TabbedPanels.addEventListener(this.focusElement, "blur", function(e) { return self.onTabBlur(e, tab); }, false);
			Spry.Widget.TabbedPanels.addEventListener(this.focusElement, "keydown", function(e) { return self.onTabKeyDown(e, tab); }, false);
		}
	}
};

Spry.Widget.TabbedPanels.prototype.showPanel = function(elementOrIndex)
{
	var tpIndex = -1;
	
	if (typeof elementOrIndex == "number")
		tpIndex = elementOrIndex;
	else // Must be the element for the tab or content panel.
		tpIndex = this.getTabIndex(elementOrIndex);
	
	if (!tpIndex < 0 || tpIndex >= this.getTabbedPanelCount())
		return;

	var tabs = this.getTabs();
	var panels = this.getContentPanels();

	var numTabbedPanels = Math.max(tabs.length, panels.length);

	for (var i = 0; i < numTabbedPanels; i++)
	{
		if (i != tpIndex)
		{
			if (tabs[i])
				this.removeClassName(tabs[i], this.tabSelectedClass);
			if (panels[i])
			{
				this.removeClassName(panels[i], this.panelVisibleClass);
				panels[i].style.display = "none";
			}
		}
	}

	this.addClassName(tabs[tpIndex], this.tabSelectedClass);
	this.addClassName(panels[tpIndex], this.panelVisibleClass);
	panels[tpIndex].style.display = "block";

	this.currentTabIndex = tpIndex;
};

Spry.Widget.TabbedPanels.prototype.attachBehaviors = function(element)
{
	var tabs = this.getTabs();
	var panels = this.getContentPanels();
	var panelCount = this.getTabbedPanelCount();

	for (var i = 0; i < panelCount; i++)
		this.addPanelEventListeners(tabs[i], panels[i]);

	this.showPanel(this.defaultTab);
};

})(); // EndSpryComponent

