window.onload = function()
{
		if (self.innerWidth)
				{
					frameWidth = self.innerWidth;
					frameHeight = self.innerHeight;
			} else if (document.documentElement && document.documentElement.clientWidth)
						{
							frameWidth = document.documentElement.clientWidth;
							frameHeight = document.documentElement.clientHeight;
						}else if (document.body)
								{	
								frameWidth = document.body.clientWidth;
								frameHeight = document.body.clientHeight;
								}
							session.location.href='library/includes/sessionframe.php?process=1&width=' + frameWidth + '&height=' + frameHeight;

}



function popupthankyou()
{
 var newWindow = window.open("thankyou_pop_under.htm", "Thank You", "location=no,width=720,height=525"); 
 newWindow.blur();;
}


function popup_ads()
{
 var newWindow = window.open("includes/PackagDeal_PopUnder.php","PopUPAds","location=no,width=482,height=480");  
}

function popup_ads_es()
{
 var newWindow = window.open("includes_es/PackagDeal_PopUnder_es.htm","PopUPAds","location=no,width=482,height=470");  
}

function popup_ads2()
{
 var newWindow = window.open("/includes/specialspopup.php", "PopUpAds2", "location=no,width=770,height= 500");  
}





function all_popups(image,alt,parm)
{
var page = "/includes/popup.php?image=" + image + "&alt=" + alt ;
 var newWindow = window.open( page, alt, parm);  
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
 var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
   var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
   if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);


function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}



function popup()
{
  window = window.open("/includes/specialspopup.php", "InternetSpecial", "location=no,width=600,height= 532"); 
}

function doc_pop_up(page,name,options)
{
		winRef = window.open(page,name,options);
		winRef.focus();
}

function window_pop_up (file_name,window_title,window_options)
{
 var newWindow = window.open(file_name, window_title, window_options);  
}

function toggledivs (id)
{
		var msg = id + ' ' + window.div_status[id] ;
		var folder_open = id + '_open';
		var folder_closed = id + '_closed';
		
		if (window.div_status[id])
			{
				hidediv(id);	
				hidediv(folder_open);			
				showdiv(folder_closed);					
				window.div_status[id] = 0;
			} else
				{
					showdiv(id);
					hidediv(folder_closed);			
					showdiv(folder_open);
					window.div_status[id] = 1;
				}
		//hideallids(ids);
		//showdiv(show);
}

function switchdivs (ids,show)
{
		hideallids(ids);
		showdiv(show);
}


function hideallids(ids)
{
	var broken_ids = ids.split(',');
	//loop through the array and hide each element by id	
	for (var i=0;i<broken_ids.length;i++){
		hidediv(broken_ids[i]);
	}		  
}

function hidediv(id) {
	//safe function to hide an element with a specified id
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'none';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'none';
		}
		else { // IE 4
			document.all.id.style.display = 'none';
		}
	}
}

function showdiv(id) {
	//safe function to show an element with a specified id
		  
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
}

function moveshowdiv(id,ids) 
{
	//safe function to show an element with a specified id
	span_name = 'span_' +id
	var link_pos = Position.get(span_name);	
	//var pos =getPosition(e);	
	var broken_ids = ids.split(",");
	for (var i=0;i<broken_ids.length;i++){
		hidediv(broken_ids[i]);
	}	
	//var  main_index_featured_height = document.getElementById('main_index_featured').offsetHeight;
	//var  main_index_col2_height = document.getElementById('main_index_col2').offsetHeight;
	//document.getElementById('main_index_featured').style.top= 20;
	//document.getElementById('main_index_col2').style.height= (main_index_col2_height + 66) ;
	//document.getElementById('col1_box1').style.marginBottom= 35 ;
	//var id_height = document.getElementById(id).offsetHeight;
	
	if (document.getElementById) { // DOM3 = IE5, NS6
		document.getElementById(id).style.display = 'block';
	}
	else {
		if (document.layers) { // Netscape 4
			document.id.display = 'block';
		}
		else { // IE 4
			document.all.id.style.display = 'block';
		}
	}
	//document.getElementById(id).style.top= pos.y;
	var id_height = document.getElementById(id).offsetHeight;
	var id_left = document.getElementById(id).offsetLeft;
	var id_top = document.getElementById(id).offsetTop;
	var new_top =((link_pos.top-id_height)-10);
	var new_top_bottm =(link_pos.top+60);
	if (new_top < 5)
		{
			Position.set(id,id_left,new_top_bottm);			
		} else
			{
					Position.set(id,id_left,new_top);			
			}
			
	var id_top_new = document.getElementById(id).offsetTop;
	var mesg= 'top:' + link_pos.top + 'pop:' + id_top +'new:' + id_top_new;	
	//document.getElementById(id).style.top= ((link_pos.top-id_height)-10);
	
}




function trigger_menu (e,menu,tab)
{
	var pos =getPosition(e);
	var menu_pos = Position.get (menu);
	var top = (menu_pos.top - 1);
	var left =(menu_pos.left + 1);
	var bottom = (menu_pos.top + menu_pos.height) -1;
	var right = (menu_pos.left + menu_pos.width) -1;
	if ((pos.y > bottom) || (pos.y < top) || (pos.x > right) || (pos.x < left) )
		{
			var status = 'out';
			//test two the tab
				var tab_pos = Position.get (tab);
				var top = (tab_pos.top - 1);
				var left =(tab_pos.left + 1);
				var bottom = (tab_pos.top + tab_pos.height) +1;
				var right = (tab_pos.left + tab_pos.width) -1;
				if ((pos.y > bottom) || (pos.y < top) || (pos.x > right) || (pos.x < left) )
					{
						hidediv(menu);			
					}			
		} else
			{
				var status='in';
			}			
	//mesg = 'cursor:' + pos.x + ' ' + pos.y + '	Menu: ' + menu_pos.left + ' ' + menu_pos.top + ' ' + bottom + ' ' + right + ' status: ' + status;
	//alert(mesg);

	
}

/**
 * Copyright (c)2005-2007 Matt Kruse (javascripttoolbox.com)
 * 
 * Dual licensed under the MIT and GPL licenses. 
 * This basically means you can use this code however you want for
 * free, but don't claim to have written it yourself!
 * Donations always accepted: http://www.JavascriptToolbox.com/donate/
 * 
 * Please do not link to the .js files on javascripttoolbox.com from
 * your site. Copy the files locally to your server instead.
 * 
 */
eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('6 P=(g(){g q(s){3(8.n&&8.n(s)!=9){a 8.n(s)}w 3(8.l&&8.l[s]!=9){a 8.l[s]}w 3(8.e&&8.e.v&&8.e.v>0&&8.e[0].x){Q(6 i=0;i<8.e.v;i++){3(8.e[i].O==s){a 8.e[i]}}}}6 b={};b.$S=1.0;b.R=g(o,5,7){3(u(o)=="D"){o=q(o)}3(o==9||!o.t){a J}3(u(5)=="X"){6 b=5;5=b.5;7=b.7}o.t.5=5+"I";o.t.7=7+"I";a p};b.F=g(o){6 H=p;3(u(o)=="D"){o=q(o)}3(o==9){a 9}6 5=0;6 7=0;6 h=0;6 j=0;6 k=9;6 d=9;d=o.d;6 f=o;6 4=o;T(4.k!=9){4=4.k;3(4.d==9){}w{6 m=p;3(H&&N.U){3(4==f.k||4.A=="W"){m=J}}3(m){3(4.y&&4.y>0){7-=4.y}3(4.r&&4.r>0){5-=4.r}}}3(4==d){5+=o.B;3(4.G&&4.A!="K"){5+=4.G}7+=o.z;3(4.L&&4.A!="K"){7+=4.L}o=4;3(o.d==9){3(o.B){5+=o.B}3(o.z){7+=o.z}}d=o.d}}3(f.C){h=f.C}3(f.E){j=f.E}a{\'5\':5,\'7\':7,\'h\':h,\'j\':j}};b.V=g(o){6 c=M.F(o);3(c==9){a 9}c.5=c.5+(c.h/2);c.7=c.7+(c.j/2);a c};a b})();',60,60,'|||if|el|left|var|top|document|null|return|pos||offsetParent|anchors|originalObject|function|width||height|parentNode|all|considerScroll|getElementById||true|resolveObject|scrollLeft||style|typeof|length|else||scrollTop|offsetTop|nodeName|offsetLeft|offsetWidth|string|offsetHeight|get|clientLeft|fixBrowserQuirks|px|false|TABLE|clientTop|this|window|name|Position|for|set|VERSION|while|opera|getCenter|TR|object'.split('|'),0,{}))



function getPosition(e)
 {
    e = e || window.event;
    var cursor = {x:0, y:0};
	var browser=navigator.appName;
	// 	 if (browser=="Microsoft Internet Explorer") 
	 if (e.pageX || e.pageY) 
  	{
        cursor.x = e.pageX;
        cursor.y = e.pageY;
    } 
    else {
        var de = document.documentElement;
        var b = document.body;
        cursor.x = e.clientX + (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0);
        cursor.y = e.clientY +  (de.scrollTop || b.scrollTop) - (de.clientTop || 0);
    }
    return cursor;
}
