﻿function detect() 
{ var framesetpage = "Default.aspx" 
   if (parent.location.href == window.location.href) 
      parent.location.href = framesetpage + '?pg=' + file_name_only(window.location.href)} 
      
function file_name_only(str) 
{ 
    var slash = '/' 
    if (str.match(/\\/)) { 
        slash = '\\' 
    } 
    return str.substring(str.lastIndexOf(slash) + 1, str.lastIndexOf('.')) 
} 