function changeimage(towhat,url){
if (document.images){
document.images.targetimage.src=towhat.src;
gotolink=url;
}
}

//function changeimagebyid(towhat,url,id){
function changeimagebyid(towhat,url){
var id = document.getElementById(id);
//id.onMouseover = function() {
if (document.images){
document.images.lt.src=towhat.src;
gotolink=url;
}
}
//}

function warp(){
window.location=gotolink;
}
var myimages=new Array();
var gotolink="#";

function preloadimages(){
for (i=0;i<preloadimages.arguments.length;i++){
myimages[i]=new Image();
myimages[i].src=preloadimages.arguments[i];
}
}


function popUp(URL) {
day = new Date();
id = day.getTime();
if (document.images){
        var img = document.images.targetimage.src;
        eval("page" + id + " = window.open(img, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=750,height=800');");
} else {
        eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=750,height=800');");
}
//eval("page" + id + " = window.open(img, '" + id + "', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=700,height=1000');");
 
}

function AddToFavorites()  
{  
    var title = document.title; var url = location.href;  
    if (window.sidebar) // Firefox  
        window.sidebar.addPanel(title, url, '');  
    else if(window.opera && window.print) // Opera  
    {  
        var elem = document.createElement('a');  
        elem.setAttribute('href',url);  
        elem.setAttribute('title',title);  
        elem.setAttribute('rel','sidebar'); // required to work in opera 7+  
        elem.click();  
    }   
    else if(document.all) // IE  
        window.external.AddFavorite(url, title);  
}

function social( show_page, back_page, item, msg, id)
{
  //   document.write("<td height=\"4\"><img src=\"images/spacer_clear.gif\" width=\50\" height=\"4\"></td>"); 
 
        document.write("<td><script type=\"text/javascript\" src=\"http://platform.linkedin.com/in.js\"></script><script type=\"in/share\"></script></td>");                      
     document.write("<td><a name=\"fb_share\"></a></td><td><a href=\"http://twitter.com/share\" class=\"twitter-share-button\" data-count=\"horizontal\" data-via=\"cutecamcase\">Tweet</a></td>");                     
       document.write("<td><a href=\"mailto:cutecamcase@gmail.com?subject=My Wish List for: "+msg+"\"><b><u>Wish List</u></a></b></td>");
         document.write("<td><a href=\"mailto:?subject=Shopping "+msg+" at http://www.cutecamcase.com: "+item+"&body=http://www.cutecamcase.com/"+show_page+"?"+id+"="+item+" \" title=\"email\"><img src=\"images/link-email.gif\" border=\"0\" title=\"email\" alt=\"email\" width=\"20\" height=\"20\"></a></td>");
       document.write("<td><a rel=\"nofollow\" href=\"http://delicious.com/post?url=http://www.cutecamcase.com/"+show_page+"?"+id+"="+item+"&back="+back_page+"&title=Shopping "+msg+" at www.cutecamcase.com\" title=\"del.icio.us\"><img src=\"images/services-sprite.gif\" title=\"del.icio.us\" alt=\"del.icio.us\" style=\"width: 16px; height: 16px; background: transparent url(http://www.cutecamcase.com/images/services-sprite.png) no-repeat; background-position:-199px -1px\" class=\"sociable-hovers\" /></a></td>");
     document.write("<td><a rel=\"nofollow\" href=\"http://www.google.com/bookmarks/mark?op=edit&bkmk=http://www.cutecamcase.com/"+show_page+"?"+id+"="+item+"&back="+back_page+"&title="+item+"&annotation=The "+msg+" from http://www.cutecamcase.com\" title=\"Google Bookmarks\"><img src=\"images/services-sprite.gif\" title=\"Google Bookmarks\" alt=\"Google Bookmarks\" style=\"width: 16px; height: 16px; background: transparent url(http://www.cutecamcase.com/images/services-sprite.png) no-repeat; background-position:-91px -19px\" class=\"sociable-hovers\" /></a></td>");
     document.write("<td><a rel=\"nofollow\" href=\"javascript:AddToFavorites();\" title=\"Add to favorites\"><img src=\"images/services-sprite.gif\" title=\"Add to favorites\" alt=\"Add to favorites\" style=\"width: 16px; height: 16px; background: transparent url(http://www.cutecamcase.com/images/services-sprite.png) no-repeat; background-position:-181px -73px\" class=\"sociable-hovers\" /></a></td>");
      //   document.write("<td height=\"4\"><img src=\"images/spacer_clear.gif\" width=\50\" height=\"4\"></td>");  
    // document.write("<td><iframe src=\"http://www.facebook.com/widgets/like.php?layout=button_count&show_faces=false&width=148&href=http://www.cutecamcase.com/"+show_page+"?"+id+"="+item+"&back="+back_page+"&action=recommend\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; width:290px; height:20px\"></iframe></td>");
         document.write("<td><iframe src=\"http://www.facebook.com/widgets/like.php?layout=button_count&show_faces=false&width=148&href=http://www.cutecamcase.com/"+show_page+"?"+id+"="+item+"&back="+back_page+"&action=recommend\" scrolling=\"no\" frameborder=\"0\" style=\"border:none; width:90px; height:20px\"></iframe></td>");

}
//google conversion
 var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-10683958-2']);
  _gaq.push(['_trackPageview']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
  })();
  
function getValue(varname)
{
  // First, we load the URL into a variable
  var url = window.location.href;

  // Next, split the url by the ?
  var qparts = url.split("?");

  // Check that there is a querystring, return "" if not
  if (qparts.length == 0)
  {
    return "";
  }

  // Then find the querystring, everything after the ?
  var query = qparts[1];

  // Split the query string into variables (separates by &s)
  var vars = query.split("&");

  // Initialize the value with "" as default
  var value = "";

  // Iterate through vars, checking each one for varname
  for (i=0;i<vars.length;i++)
  {
    // Split the variable by =, which splits name and value
    var parts = vars[i].split("=");
    
    // Check if the correct variable
    if (parts[0] == varname)
    {
      // Load value into variable
      value = parts[1];

      // End the loop
      break;
    }
  }
  
  // Convert escape code
  value = unescape(value);

  // Convert "+"s to " "s
  value.replace(/\+/g," ");
  document.write("the return value is:"+value);

  // Return the value
  return value;
 
}

