function closeInnerWindow()
{
	document.getElementById('innerWindowFrame').src = "";
	document.getElementById('innerWindow').style.visibility = 'hidden';
	document.getElementById('innerWindowContent').style.visibility = 'hidden';
}

function closeParentInnerWindow()
{
	var p = window.parent;
	p.document.getElementById('innerWindow').style.visibility = 'hidden';
	p.document.getElementById('innerWindowContent').style.visibility = 'hidden';
	p.document.getElementById('innerWindowFrame').src = "";
}

function maximizeInnerWindow()
{
	var iw = window.parent.document.getElementById('innerWindowContent');
	var iframe = window.parent.document.getElementById("innerWindowFrame");
	
	//	Initialize Layer
	bgW = document.body.clientWidth * 0.90;
	bgH = (document.body.clientHeight - 50) * 0.75;
	
	bgL = document.body.clientWidth * 0.1 / 2;
	bgT = 10;

	
	iw.style.left = bgL;
	iw.style.top = bgT;
	iframe.style.left = bgL;
	iframe.style.top = bgT;
	
	iw.style.height = bgH + 30;
	iw.style.width = bgW + 5;
	
	iframe.height = bgH;
	iframe.width = bgW;
}

function restoreInnerWindow()
{
	h = oHeight;
	w = oWidth;
	
	//	Initialize Layer
	bgW = document.body.clientWidth;
	bgH = document.body.clientHeight;
	
	bgW = document.body.clientWidth;
	bgH = document.body.clientHeight;
	
	msgW = w + 5;
	msgH = h + 30;
	
	msgL = ( bgW - w - 5 )/ 2;
	msgT = ( bgH - h - 5 ) * 0.75/ 2;
	
	var innerWindowContent = document.getElementById("innerWindowContent");
	innerWindowContent.style.left = msgL;
	innerWindowContent.style.top = msgT;
	innerWindowContent.style.height = msgH;
	innerWindowContent.style.width = msgW;
	innerWindowContent.style.visibility = "visible";
	
	var innerWindowFrame = document.getElementById("innerWindowFrame");
	innerWindowFrame.height = h;
	innerWindowFrame.width = w;
	
}


function newWindow(u, t, s)
{
	if(s == "")
	{
		window.open(u,t,"toolbar=no,status=no,menubar=no,scrollbars=yes");
	}
	else
	{
		window.open(u,t,"scrollbars=yes," + s);
	}
}

function newFrame(u, w, h)
{
	window.scrollTo(0,0);
	
	
	oHeight = h;
	oWidth = w;
	
	//	Detect width and height
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) 
	{
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} 
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
	{
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	} 
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
	{
		//IE 4 compatible
		myWidth = document.body.clientWidth;
		myHeight = document.body.clientHeight;
	}
	
	//	Initialize Layer
	myWidth = document.body.clientWidth;
	myHeight = document.body.clientHeight;
	myWidth = document.body.offsetWidth;
	myHeight = document.body.offsetHeight;
	// alert(document.body.scrollHeight);
	bgW = document.body.scrollWidth;
	bgH = document.body.scrollHeight;
	var innerWindow = document.getElementById("innerWindow");

	innerWindow.style.height = bgH;
	innerWindow.style.width = bgW;
	innerWindow.style.top = 0;
	innerWindow.style.left = 0;
	// innerWindow.onclick = closeInnerWindow;
	innerWindow.style.visibility = "visible";
	
	msgW = w + 5;
	msgH = h + 30;
	
	msgL = ( bgW - w - 5 )/ 2;
	msgT = (  document.documentElement.clientHeight - h - 5 ) * 0.75/ 2;
	
	if(msgT < 0)
		msgT = 0;
	
	if(msgL < 0)
		msgL = 0;
	
	var innerWindowContent = document.getElementById("innerWindowContent");
	innerWindowContent.style.left = msgL;
	innerWindowContent.style.top = msgT;
	innerWindowContent.style.height = msgH;
	innerWindowContent.style.width = msgW;
	innerWindowContent.style.visibility = "visible";
	
	var innerWindowFrame = document.getElementById("innerWindowFrame");
	innerWindowFrame.height = h;
	innerWindowFrame.width = w;
	innerWindowFrame.src = u;
}

function confirmBeforeGo( url )
{
	var answer = confirm("Are you sure?");
	if(answer)
	{
		window.location = url;
	}
}








function go(a)
{
	window.location = a;
}

function home()
{
	window.location = "indexTop.php";
}


function register()
{
	clearTimeout(cTimer);
	newFrame("signUp01.php", 720, 560);
}

function myAccount()
{
	// newFrame("myAccount.php", 1000, 540);
	window.location = "myAccount.php";
}

function logout()
{
	window.location = "indexTop.php?Logout=1";
}

function viewBrand(b)
{
	if(b > 0)
	{
		window.location = 'viewByBrand.php?Brand=' + b;
	}
}

function refreshCart()
{
	// alert("Hello !");
	var t = parent.bottomFrame;
	if(t == null)
	{
		t = parent.frames[1];
	}
	
	if(t != null)
	{
		
		t.showCart();
	}
	
}

function refreshBrand()
{
	var t = parent.bottomFrame;
	
	if(t == null)
	{
		t = parent.frames[1];
	}
	
	
	if(t != null)
	{
		t.showBrand();
	}
}


