//alert("MainScript Start");
var StackCateCache = "";
var xType = "";
var xParams="";
var x_Url = "";
var x2Params = ""; /// <reference path="preInit.js" />

var x2_Url = "";
var stackLevel = 0;
var stackParms = [];
var level;
var CategorySearchAtInfiniview = true;

var iPhonePathCat = ""; 
var RelatedViewChkr = false;
// Setting For sites Global Variables
//DONE BY ASHER SYED ON 20080318 FOR SAVING CURRENT STATE OF PRODUCT COMMANDS FILESYSTEM
//VALID VALUES
//0
//1
//2
//3
var PRODUCTCOMMAND_STATE = 0;
//Product Config Wizard Control Name
var WizCtrlName = "PRODUCTCONFIGWIZARD";
//Current No of Levels For Wizard
var WizardLevelCount = 0;


// Page Layout By Resulation 
//-------------------------------------------------------
/**
var addURLRef = new Array(0); 
//
addURLRef = new Array(10);
addURLRef[0] = "www.coof.com";
addURLRef[1] = "www.alphapa.com";
addURLRef[2] = "www.businessstarterpack.com";
addURLRef[3] = "www.infini.co.uk";
addURLRef[4] = "www.x-t.com";
//
**/
//var resizeInfiniViewWithResolution = false; 
//fullViewWithURLs();
//-------------------------------------------------------
var _Domain = "http://" + window.location.host;
var GetiViewSource; 
var CheckGetView = true;
var fullScreenImage; 
var fullScreenIframeSrc; 
var InfiniOfficePage = "http://" + window.location.host + "/AJAX/InfiniOffice.aspx"; 
var EQuotePage = "http://" + window.location.host + "/AJAX/eQuoteProducts.aspx"; 
var EbayPage = "http://" + window.location.host + "/AJAX/ebay.aspx"; 
var catPlusPic, catMinusPic;
var mainPagePic;
var onMouseOverCatbkgd,onMouseOutCatbkgd,onClickCatBkgd;
var loadPagesImage;
var topCategory, leftCategory;
var SetRelative = '1';
// FOR CYCLE FILES
var timer;
var sliderTimer;
var TimeToWaitForFilesToLoad = 1;
var CycleFileDelay = 20;
// FOR MUTE
var MuteState;
//FOR SOUND IMAGES
var mute_image = "../images/sound.gif";
var sound_image = "../images/mute.gif";

//FOR PRODUCT -- CONVINCEME ETC
//var CurrentProductID = 0;
var CurrentProductPrice = "0.00";

var CurrentSlideShow = 0;
var product_image = "../images/cat_img/new/product.gif";
var simple_image = "../images/cat_img/new/convince_simple.gif";
var framLoading;
var relatedProductLength = new Array(0);
var currentRelatedProduct;
var relatedPro_ParentID;	// Created on 10 August for temp related Parent product
var homePagebanner_Process1;
var homePagebanner_Process2;
//For Using Database or File System for Product Files 
//Both variables can not be simultaneously true
var USE_DATABASE_PRODUCTCOMMANDS = false;
var USE_FILESYSTEM_PROUDCTCOMMANDS = true;

//var _ProductCommands;
//var _SlideShowCommands;

var productCmdQuerry;
var currentRelatedProId;
// Start Setting.
var catloadChecker,advertisementChecker,bannerChecker;
var _wizardGlobalChk;
var _relatedresultchk;
var _resWizardPro;
var BackProImg = "ProImginit";
var lastRowId, lastRowFontId;		//	Crea ted on 14 November 2007 for new updation last row activation.
var fullDomainName ="" ;		// used to preserver the complete domain name
var redirectURL;
var category_Loading;
var framehistory;
//var _mainCateId,_mainCatImage;
var navigateToHome = false;
var horizontalDefaultCat;
// Variables For Share URL By Usman 08.02.2008
var Comp_URL;
var Comp_URL_Fav;
var URL_Fav;
var addtoLayout;
var addtoMethod;
var AddURL;
var AddTitle;
var Pro_NewID;
// Done Variables For Share URL By Usman 08.02.2008
var dom;
var ns4;
var present;
//var catComView;
var imgchkHistory,imgchkHistoryId;
var MouseOver_DisableEnable;
var currentCenterImage;
var clikedMouseOver;
var PreviewControl = false;


clikedMouseOver = null;
MouseOver_DisableEnable = "True";
imgchkHistory = 0;
imgchkHistoryId = null;
present = "h_contectFirst";
dom = document.getElementById?1:0;
ns4 = document.layers?1:0;
horizontalDefaultCat = 1;
//_mainCatImage = null;
//_mainCateId = null;
//framehistory = null;
framehistory = "undefined";
//mainPagePic = "/images/main_page_new_13.jpg";	// Main default page center picture
//mainPagePic = "../Images_Private/Main_Image/main.html";	// Main default page center picture
//catPlusPic = '../images/b4l_s_plus.gif';		// Plus sign for categories
//catMinusPic = '../images/b4l_s_minus.gif';		// Minus sign for categories
mainPagePic = switchStringForIPhone("../Images_Private/Main_Image/main.html","");	
catPlusPic = switchStringForIPhone('../images/b4l_s_plus.gif','../wap_images/b4l_s_plus.gif') ;
catMinusPic = switchStringForIPhone('../images/b4l_s_minus.gif','../wap_images/b4l_s_minus.gif');

//onMouseOverCatbkgd = '#000000';		// Categories OnMouseOver background color
//onMouseOutCatbkgd = '#333333';		// Categories OnMouseOut background color
//onClickCatBkgd = '#B6D0E4';	//'#D0D0D0';			// Categories OnMouseClick background color

onMouseOverCatbkgd = "CatHoverBGColor";		// Categories OnMouseOver background color
onMouseOutCatbkgd = "CatMouseOutBGColor";		// Categories OnMouseOut background color
onClickCatBkgd = 'CatClickBGColor';	//'#D0D0D0';			// Categories OnMouseClick background color

//loadPagesImage = "<img src='/images/cat_img/new/circle-ball-dark-antialiased.gif' border='0' align='middle' />";	// image shows while data loaded
//loadPagesImageCenter = "<img src='/images/cat_img/new/indicator.gif' border='0' align='middle' />";	// image shows while data loaded
//loadPagesImage = "<img src='/images/ProgressBar.gif' border='0' vAlign='middle' align='center' />";	// image shows while data loaded
var loadPagesImageCenter = "<img src='../images/ProgressBar.gif' border='0' vAlign='middle' align='center' />";	// image shows while data loaded
var loadPagesImage = "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='0'><tr><td align='center' valign='bottom' class='LoadingText'><img src='../images/blank.gif' border='0' width='5' height='5' vAlign='middle' align='center' /></td></tr><tr><td align='center' valign='top'>"+loadPagesImageCenter+"</td></tr></table>";
topCategory = 0;
leftCategory = 0;

catloadChecker = "Process";
advertisementChecker = "Done";
//bannerChecker = "Process";
bannerChecker = "Done";
frameLoading = "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='0'><tr><td align='center' valign='bottom' class='LoadingText'>Loading..</td></tr><tr><td align='center' valign='top'>"+loadPagesImageCenter+"</td></tr></table>";
homePagebanner_Process1 = "Process";
homePagebanner_Process2 = "Process";
_resWizardPro = "";
//redirectURL = "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='0'><tr><td align='center' valign='bottom' class='LoadingText'>Redirecting in Process. ..</td></tr><tr><td align='center' valign='top'>"+loadPagesImageCenter+"</td></tr></table>";
redirectURL = "<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='0'><tr><td align='center' valign='bottom' class='LoadingText'>Redirecting in Process. ..</td></tr></table>";
///		End Global Variables


var GlobalMpQuery;
//var sldbox = 0;
var sldbox;
//********************************** Market place Ajax *****************************************
		
	
   function MarketPlace_CheckOut()
   {
		var url = "http://" + window.location.host + "/BestOffer/PurchasedOrder.aspx" + GlobalMpQuery   ; 
		SetSource(url);  
	}

	function RedirectPlaceBid() 
    { 
		src="http://" + window.location.host + "/Specialize/PlaceControllBidBid.aspx" + GlobalMpQuery ;
		SetSource(src);  
    } 
	function ApprovedSupplier()
	{
		var url = "http://" + window.location.host + "/MP_AJAX/MP_PlaceBid.aspx" + window.location.search + '&mp_approved=approved' ;
		var frm=parent.document.getElementById('frame_details');
		frm.src=url;
	}

function RedirectPlaceBestOfferBid() 
{

    var PQnty=document.getElementById('lbl_quantity').innerText;
    var NPrice=document.getElementById('new_offer').value;
//    var DPeriod=document.getElementById('delivery_period').value;
    var qstring = "new_offer="+NPrice+"&purchased_quantity="+PQnty;
    //&period="+DPeriod;  
    var url ="http://" + window.location.host + "/MP_AJAX/MP_PlaceBid.aspx" + GlobalMpQuery + "&" + qstring;
    //window.frames["frame_details"].location=url;
    SetSource(url);  
 /** 
			  var xmlRequest = DoCallback(url,"")
			//document.getElementById("ACTIVECOMMANDS").innerHTML = xmlRequest.responseText;
			//document.getElementById("ACTIVECOMMANDS").style.visibility = 'visible';
			if (xmlRequest){ 
			var str = xmlRequest.responseText;
			
			var MyDiv = document.getElementById('ACTIVECOMMANDS');
			MyDiv.style.visibility= 'visible';
			MyDiv.innerHTML = str; 		
			} 
			else {
			var MyDiv = document.getElementById('ACTIVECOMMANDS');
			MyDiv.style.VISIBILITY= 'visible';
			MyDiv.innerHTML = str; 		
			} **/
 } 



function GetMP_ProductDetails(Query)	
{	
	GlobalMpQuery=Query;
	var url = "http://" + window.location.host + "/MP_AJAX/MP_ProductDetails.aspx" + Query ;
	
	var xmlRequest = DoCallback(url,"");
	//document.getElementById("ACTIVECOMMANDS").innerHTML = xmlRequest.responseText;
	//document.getElementById("ACTIVECOMMANDS").style.visibility = 'visible';
	if (xmlRequest)
	{ 
		var str = xmlRequest.responseText;
		var MyDiv = document.getElementById('ACTIVECOMMANDS');
		MyDiv.style.visibility= 'visible';
		MyDiv.innerHTML = str; 		
	} 
	else 
	{
		var MyDiv = document.getElementById('ACTIVECOMMANDS');
		MyDiv.style.VISIBILITY= 'visible';
		MyDiv.innerHTML = str; 		
	}
	
}
   
function updatetotal()
{
	var txt1 = document.getElementById('new_offer');
	var txt2 = document.getElementById('lbl_quantity').innerText; //document.getElementById('Purchase_Quantity');
	var Result =Number(txt1.value) * Number(txt2);
	document.getElementById('total_price').value= Result;
}


function BestOfferBid()
{	
	
	var url = "http://" + window.location.host + "/MP_AJAX/MP_ProductDetails.aspx" + GlobalMpQuery + "&placebid=true" ;

	var xmlRequest = DoCallback(_Domain + "/" + url,"");
	if (xmlRequest)
	{ 
		var str = xmlRequest.responseText;
		
		if (str=='NOTLOGIN')
			{
			
			SetSource('/MP_AJAX/MP_bid.aspx'+GlobalMpQuery);
			}	
			else
			{
			 PlaceBestOfferBid(); 		
			}
	} 
	else 
	{
	}
}



//************************************	Market Place Functions    **********************************************************  

//Popup by shahzeb

function popwindiw()
{
	document.window.open("https://www.infinishops.com/popup_blck.aspx","_blank");
}
//End popup
var currentImageNo = 0;
var supportURL;
// Cookies for popup window		13 March 2007

function getCookie(c_name)
{
	if (document.cookie.length>0)
	{ 
		c_start=document.cookie.indexOf(c_name + "=");
		if (c_start!=-1)
		{ 
			c_start=c_start + c_name.length+1; 
			c_end=document.cookie.indexOf(";",c_start)
			if (c_end==-1) c_end=document.cookie.length
			return unescape(document.cookie.substring(c_start,c_end))
		} 
	}
	return ""
}

function setCookie(c_name,value,expiredays)
{
	var exdate=new Date()
	exdate.setMinutes(exdate.getMinutes()+expiredays)
	//exdate.getMinutes() + 3;
	document.cookie=c_name+ "=" +escape(value)+	((expiredays==null) ? "" : "; expires="+exdate.toGMTString())
}

function checkCookie()
{
	username = getCookie('username')
	if (username != null && username != "")
  	{
		return;
	}
	else 
  	{
  		username="http://www.infinibot.com/index.php?greeting=helloinfinishops"
		url = "http://www.infinibot.com/index.php?greeting=helloinfinishops";
		delay = 3600;    // time in seconds before popup opens
		timer = setTimeout("Start(url)", delay*1000000);
		
		if (username!=null && username!="")
		{
			setCookie('username',username,8)
	    }
	    
	    /* Done By Asher Syed On 21-03-2007 for Dynamnic Support URL.

		username = "support";
		var url = "http://" + location.hostname + "/Utility.asmx/GetSupportURL";
		var xmlRequest = CallWebService(url, null);
		supportURL = xmlRequest.responseXML.text;
		delay = 10;    // time in seconds before popup opens
		timer = setTimeout("Start(supportURL)", delay*1000);
		
		if (username!=null && username!="")
		{
			setCookie('username', username, 8)
	    }
	    
	    */
	}
}

// Open window after amount of time

var closetime = 0; // Close window after __ number of seconds?
// 0 = do not close, anything else = number of seconds

function Start(URL) 
{
	preview = window.open(URL,'mywindow');
	if (closetime) setTimeout("preview.close();", closetime*1000);	
}

// Cookies End

var srchTopvar;		// Var for search result top layer visble
var simpleTopVar;	// Var for simple result top layer visble

srchTopvar = "hide";
simpleTopVar = "hide";

// OnClick imageChange

function roll_over(img_name, img_src)
{
	try{
	document.getElementById(img_name).src = img_src;
	}catch(e){}

}

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; 
			var onresize=MM_reloadPage; 
		}
	}
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) 
		location.reload();
}
MM_reloadPage(true);

// OnClick ImageChange End


/*function doPopup() 
{
	url = "http://www.infinibot.com/index.php?greeting=helloinfinishops";
	delay = 10;    // time in seconds before popup opens
	timer = setTimeout("Start(url)", delay*1000);
}*/

// End of window

// Default page row

function spaceRow()
{
}
function FavSpaceRowVis()
{
	if(document.getElementById("ACTIVECOMMANDS").innerHTML == "")
	{
		document.getElementById("rowspace").innerHTML = "<img src='../images\blank.gif' width='1' height='9' />";
	}
	else if(document.getElementById("ACTIVECOMMANDS").innerHTML != "")
	{
		//document.all.rowspace.innerHTML = "<img src='\images\blank.gif' width='1' height='77' />";
		return;
	}

}
function spaceRowVis()
{
	if (timer != null)
	{
		stop();
	}
}
function spaceRowVisBuy()
{
	if (timer != null)
	{
		stop();
	}
	if(document.getElementById("rowspace").innerHTML == "")
	{
		document.getElementById("rowspace").innerHTML = "<img src='../images\blank.gif' width='1' height='33' />";
	}
	else
	{
		//document.all.rowspace.innerHTML = "<img src='\images\blank.gif' width='1' height='64' />";
		//return;
	}
}

// Favourite Bar By SHAHZEB
var ProAlert;
var FavproductId;
var FavProType;
FavproductId = "";
ProAlert = 0;
function favSel()
{
	var xmlRequest = DoCallback(_Domain + "/Customer/AddFavourite.aspx?product_id=" + FavproductId + "&add=" +FavProType,"")
	if(xmlRequest.responseText == "Log_error")
	{
		SetSource("../Customer/Home.aspx");
		document.getElementById("AddFavRes").innerHTML = "<span class='text13'>Your are not logged In</span>";
	}
	else
	{
		//document.all.AddFavRes.innerHTML = xmlRequest.responseText;
	}
	this.favProductRender();
}

function noFavSel()
{
	alert("No Product selected");
}
// Created  6 August 2007 Favourite Bar Render
function renderFavouriteBar()
{
	FrameSize('');
	var xmlRequest = DoCallback(_Domain + "/AJAX/Favourites.aspx","");
	document.getElementById("FavouriteProductDiv").innerHTML = "";
	if(xmlRequest.responseText == "Log_error")
	{
		SetSource("../Customer/Home.aspx");
		document.getElementById("FavouriteProductDiv").innerHTML = "<span class='text13'>Your are not logged In</span>";
	}
	else
	{
		document.getElementById("FavouriteProductDiv").innerHTML = xmlRequest.responseText;
	}
}
function renderHistoryBar()
{
	var xmlRequest = DoCallback(_Domain + "/AJAX/History.aspx","");
	document.getElementById("HistoryResult").innerHTML = "";
	if(xmlRequest.responseText == "Log_error")
	{
		//SetSource("Customer/Home.aspx");
		document.getElementById("HistoryResult").innerHTML = "<span class='text13'>Your are not logged In</span>";
	}
	else
	{
		document.getElementById("HistoryResult").innerHTML = xmlRequest.responseText;
	}
}
//
function showMenuFav()
{
	/**
	var favTop;
	var favLeft;
	favTop = findPosY(document.getElementById("favBarView"));
	favLeft = findPosX(document.getElementById("favBarView"));

	document.getElementById("MOverFav").style.top = favTop + 30;
	document.getElementById("MOverFav").style.left = favLeft - 70;
	document.getElementById("MOverFav").style.visibility = "visible";
	//var xmlRequest = DoCallback("AJAX/FavHere.aspx", "")
	var req=null;
	req=initXMLHTTPRequest();
	if (req)
	{
		req.open("POST","AJAX/FavHere.aspx",true);
		req.onreadystatechange=function()
		{
			var ready=req.readyState;
			var data=null;
			if (ready==4)
			{
				xmlResult = req.responseText;
				if(xmlResult == "Log_error")
				{
					SetSource("../Customer/Home.aspx");
					document.getElementById("AddFavRes").innerHTML = "<span class='text13'>Your are not logged In</span>";
				}
				else
				{
					document.getElementById("AddFavRes").innerHTML = xmlResult;
					favTop = findPosY(document.getElementById("favBarView"));
					favLeft = findPosX(document.getElementById("favBarView"));
		
					document.getElementById("MOverFav").style.top = favTop + 30;
					document.getElementById("MOverFav").style.left = favLeft - 70;
		
					//document.all.AddFavRes.innerHTML = "";
					myMainCategoryMoving();
					var favLink;
					if(ProAlert == 1)
					{
						//favLink = "<a href='Javascript:' class='favheadertext' onclick='hideMenuFav(); favSel();'>Add to Favourite</a>";
						favLink = "<a href='Javascript:' class='favheadertext' onclick='favSel();'>Add to Favourite</a>";
						document.getElementById("AddFav").innerHTML = favLink;
					}
					else if(ProAlert == 0)
					{
						//favLink = "<a href='Javascript:' class='favheadertext' onclick='javascript: hideMenuFav(); noFavSel();'>Add to Favourite</a>";
						favLink = "<a href='Javascript:' class='favheadertext' onclick='javascript: noFavSel();'>Add to Favourite</a>";
						document.getElementById("AddFav").innerHTML = favLink;
					}
				}
			}
			else
			{
				document.getElementById("AddFavRes").innerHTML=frameLoading;
			}
		}
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		req.send("");
	
	}
	**/
}

function hideMenuFav()
{
	//document.getElementById("MOverFav").style.visibility = "hidden";
}
// New made by shahzeb  16 February 
// Start delete product from favourite bar

function FavProductDel(RemoveFlag , FavProId)
{
	var xmlRequest = DoCallback(_Domain + "/Customer/AddFavourite.aspx?product_id=" + FavProId + "&remove=" +RemoveFlag,"");
	//document.all.AddFavRes.innerHTML = xmlRequest.responseText;
	favProductRender();
	//hideMenuFav();
}

// End


// MENU SCROLL BY SHAHZEB

var dom = document.getElementById?1:0;
var ns4 = document.layers?1:0;
//present = "first";
var present;
var srchVal;
srchVal = 0;

var onResize = loadAgain;

function resResvalChng()
{
	
}
function MM_changeProp(objName,x,theProp,theValue) 
{ 
	var obj = MM_findObj(objName);
	if (obj && (theProp.indexOf("style.")==-1 || obj.style))
	{
		if (theValue == true || theValue == false)
		eval("obj."+theProp+"="+theValue);
		else 
		eval("obj."+theProp+"='"+theValue+"'");
  }
}
function MM_findObj(n, d) 
{
	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 loadAgain() 
{
	if (ns4)
	self.location.reload();
}
function initArrow(layerId)
{
	try
	{	
		var tablename;
		if (layerId == "content")
		{
			tablename = "first";
		}
		else if(layerId == "contentTop")
		{
			tablename = "SecondTop";
		}
		else if(layerId == "reletedProducts")
		{
			tablename = "relpro";
		}
		else if(layerId == "searchRes")
		{
			tablename = "srchres";
		}
		else if(layerId == "MainCatTop")
		{
			tablename = "maincatcontain";
		}
		else if(layerId == "FavProducts")
		{
			tablename = "FavPro";
		}
		else if(layerId == "HistoryProducts")
		{
			tablename = "HistoryPro";
		}
				
		if (dom) 
		{
			if(tablename == "first")
			{
				layer = document.getElementById(layerId).getElementsByTagName("table");
				layer[tablename].style.visibility = "visible";
				layer[tablename].style.top = 0;
			}
			/*else if(tablename == "SecondTop")
			{
				layer = document.getElementById(layerId).getElementsByTagName("table");
				layer[tablename].style.visibility = "hidden";
				layer[tablename].style.top = 0;
			}*/
			else if(tablename == "srchres")
			{
				
				try
				{
					layer = document.getElementById(layerId).getElementsByTagName("table");
					layer[tablename].style.visibility = "visible";
					layer[tablename].style.top = 0;
				}
				catch(ex){}
				
			}
			else if(tablename == "FavPro")
			{
				
				try
				{
					layer = document.getElementById(layerId).getElementsByTagName("table");
					layer[tablename].style.visibility = "visible";
					layer[tablename].style.top = 0;
				}
				catch(ex){}
				
			}
			else if(tablename == "HistoryPro")
			{
				
				try
				{
					layer = document.getElementById(layerId).getElementsByTagName("table");
					layer[tablename].style.visibility = "visible";
					layer[tablename].style.top = 0;
				}
				catch(ex){}
				
			}
			else if(tablename == "relpro")
			{

			        layer = document.getElementById(layerId).getElementsByTagName("table");
			        layer[tablename].style.visibility = "visible";
			        layer[tablename].style.top = 0;
			}
			else if(tablename == "maincatcontain")
			{
				layer = document.getElementById(layerId).getElementsByTagName("table");
				layer[tablename].style.visibility = "visible";
				layer[tablename].style.top = 0;
			}
		}

		else if(ns4) 
		{
			layer = "document['content'].document";
			eval(layer + "[tablename]" + '.visibility = "visible"');
			eval(layer + "[tablename]" + '.top = -15');
		}
	}
	catch(err)
	{
		//alert("error in initPro Function" + err.description);
	}	
}


function change(page) 
{
	if (dom) 
	{
		layer[present].style.visibility = "hidden";
		layer[page].style.visibility = "visible";
		layer[page].style.top = 0;
	}

	else if(ns4) 
	{
		eval(layer + "[present]" + '.visibility = "hidden"');
		eval(layer + "[page]" + '.visibility = "visible"');
		eval(layer + "[page]" + '.top = -15');
	}
	present = page;
}


function scrollq(direction, speed, divname)
{
	if(divname == "content")
	{
		present = "first";
	}
	else if(divname == "contentTop")
	{
		present = "SecondTop";
	}
	else if(divname == "searchRes")
	{
		present = "srchres";
	}
	else if(divname == "MainCatTop")
	{
		present = "maincatcontain";
	}
	else if(divname == "reletedProducts")
	{
		present = "relpro";
	}
	else if(divname == "FavProducts")
	{
		present = "FavPro";
	}
	else if(divname == "HistoryProducts")
	{
		present = "HistoryPro";
	}
	if (dom) 
	{
		layer = document.getElementById(divname).getElementsByTagName("table");
		var layertop = parseInt(layer[present].style.top + 5);
		var scrollheight = (document.getElementById(divname).offsetHeight - layer[present].offsetHeight);
	}

	else if (ns4) 
	{
		var layertop = parseInt(document[divname].document[present].top);
		var scrollheight = (document[divname].clip.height - document[divname].document[present].clip.height);
	}

	if (direction == "down" && layertop - 1 > scrollheight)
	{
		if (dom) 
		{
			layer[present].style.top = (layertop - speed) + "px";
		}
		else if(ns4) 
		document[divname].document[present].top = (layertop - speed);
	}	
	else if (direction == "up" && layertop < - 1 ) 
	{
		if(dom)
		{		
			layer[present].style.top = (layertop + speed) + "px";
		}
		else if(ns4)
			document[divname].document[present].top = (layertop + speed);
	}
	timer = setTimeout("scrollq('" + direction + "', " + speed +",'" + divname + "')", 10);
}

function stop() 
{

	clearTimeout(timer);
	//clearTimeout(sliderTimer);
	//StopPlayer();
	
}


//  MENU SCROLL END

// MENU BY SHAHZAIB START
var secCatRes;
var showRow,showRowFourthLvl;
var imgchk, imgchksec;
showRow = 0;
imgchk = 0;
imgchksec = 0;
//showRowTop = 0;
showRowFourthLvl = 0;

function favlink()
{
	var fav;
	fav = "<a href='#' class='link-link11'>Add to fav</a>";
	document.getElementById('addfavlink').style.display = "block";
	document.getElementById('addfavlink').innerHTML = fav;
}
function pluschange(imID, roid) {
    //if (imgchk == 0)
    if (GetUAgentMainScript() != 'MSIE') {
        if (document.getElementById(roid).style.visibility == 'visible') {
            var img = document.getElementById(imID);
            var urlName;
            //var imgLoc = '../images/b4l_s_minus.gif';
            //imgLoc = imgLoc.replace("#","");
            img.src = catMinusPic;
            imgchk = 1;
        }
        //else if(imgchk == 1)
        else if (document.getElementById(roid).style.visibility == 'hidden') {
            var img = document.getElementById(imID);
            var urlName;
            //urlName = document.domain;
            //urlName = window.location.href;
            //var imgLoc = "http://" + urlName + '/images/cat_img/new/plus.gif';
            //var imgLoc = urlName + '/images/cat_img/new/plus.gif';
            //var imgLoc = '../images/b4l_s_plus.gif';
            //imgLoc = imgLoc.replace("#","");
            img.src = catPlusPic;
            imgchk = 0;
        }
    }

}
function pluschangeSec(src, thrId) {
    //if (imgchksec == 0)
    if (GetUAgentMainScript() != 'MSIE') {
        if (document.getElementById(thrId).style.visibility == 'visible') {
            var img = document.getElementById(src);
            var urlName;
            //urlName = document.domain;
            urlName = window.location.href;
            //var imgLoc = 'http://' + urlName + '/images/cat_img/new/minus.gif';
            var imgLoc = urlName + catMinusPic;
            imgLoc = imgLoc.replace("#", "");
            img.src = imgLoc;
            //imgchksec = 1;
        }
        //else if(imgchksec == 1)
        else if (document.getElementById(thrId).style.visibility == 'hidden') {
            var img = document.getElementById(src);
            var urlName;
            //urlName = document.domain;
            urlName = window.location.href;
            //var imgLoc = 'http://' + urlName + '/images/cat_img/new/plus.gif';
            var imgLoc = urlName + catPlusPic;
            imgLoc = imgLoc.replace("#", "");
            img.src = imgLoc;
            //imgchksec = 0;
        }
    }
}
function showThrdRow()
{
}
function hideFourthTable()
{
	f1 = document.getElementById("CatResFuorth");
	f1.style.display = "none";
}
function showFourthTable()
{
	f= document.getElementById("CatResFuorth");
	f.style.display = "block";
}
function hideCatTable()
{
	f= document.getElementById("CatRes");
	f.style.display = "none";
}
/*function showCatTable()
{
	f= document.getElementById("CatRes")
	f.style.display = "block";
}*/

function hideAllRight()
{
	document.getElementById("FavouriteProductDiv").style.display= "none";
	document.getElementById("DIV_LIST").style.display= "none";
	document.getElementById("RelatedProductDiv").style.display= "none";
	document.getElementById("HistoryProductDiv").style.display= "none";
	
	
	document.getElementById("CompareProductDiv").style.display= "none";
}
function hideFavRight()
{
	if(document.getElementById("FavouriteProductDiv").style.display == "block")
	{
	    document.getElementById("FavouriteProductDiv").style.display = "none";
	    document.getElementById("favBarView").src = "../images/favourite.jpg";
	}	
}
function CatLoadCaller()
{
	if(catComView == "topper")
	{
		catloadChecker = "Done";
		checkMainInterFace();
	}
	else
	{
		
		sldbox = 1;
		document.getElementById("catBall").innerHTML = loadPagesImage;
		//var idHere = document.getElementById("catBall");
		//var xmlRequest = DoCallback("Catalog/NewCatPageDis.aspx","",idHere);
		//var xmlRequest = DoCallback("Catalog/NewCatPageDis.aspx","");
		//sendRequest("Catalog/NewCatPageDis.aspx","","DIV_LIST");
		var req=null;
		req=initXMLHTTPRequest();
		if (req)
		{
		    if (GetUAgentMainScript() != "")  
			{ 
				req.open("GET","Catalog/NewCatPageDis.aspx?iphone=true",true);
			}
			else 
			{
				req.open("GET","Catalog/NewCatPageDis.aspx",true);
			}
			req.onreadystatechange=function()
			{
				var ready=req.readyState;
				var data=null;
				if (ready==4)
				{
					// iPhone Change
				//	document.getElementById("DIV_LIST").style.width = getDynamicTransform("CatLoadCaller",220,314)["width"];
					// End iPhone Change
					document.getElementById("DIV_LIST").innerHTML = "";
					document.getElementById("DIV_LIST").innerHTML=req.responseText;
					document.getElementById("catBall").innerHTML="";
					catloadChecker = "Done";
					checkMainInterFace();
					myMainCategoryMoving();
					//document.getElementById("DIV_LIST").style.visibility = 'hidden';
				}
				else
				{
					document.getElementById("catBall").innerHTML=loadPagesImage;
				}
					//document.getElementById("DIV_LIST").innerHTML = req.responseText
				//ReadyState;
			}
			req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			req.send("");
		}	
		//document.getElementById("DIV_LIST").innerHTML = xmlRequest.responseText;
		//SetObjectSize("frame_details", 554, 237);
		///////////////SetObjectSize("frame_details", 546, 235);
		SetObjectSize("DIV_LIST", 220, 314);
	}	
	//SetObjectSize("frame_details", 561, 237);
	//SetObjectSize("DIV_LIST", 220, 226);
	SetSource(mainPagePic);
	if(!navigateToHome == true )
	{
		if (window.location.search.length > 0)
		{
			// Modify By Usman Muhammad For Direct Open product from URL 21-01-2008

			var query_new = window.location.search.substring(1); 
			var vars = query_new.split("&"); 
			for (var i=0;i<vars.length;i++) 
			{ 
				var pair = vars[i].split("="); 
				if (pair[0] == "ProURL_ID" || pair[0] == "prourl_id") 
				{ 
					myMainCategoryMoving();
					NavigateToProductFromSupport(pair[1]);
					//return pair[1]; 
				} 
			} 

			// Modify End By Usman Muhammad For Direct Open product from URL 21-01-2008

			if (CheckEQuoteQueryString() == true){return;}
			if (CheckWorkflowQueryString() == true){return;}
			
			var urlQuery = window.location.search;
			GlobalMpQuery=urlQuery;
			var MP_Query=queryString("Query")
			if ( MP_Query == 'bestoffer')
			{
				MP_Query= '\BestOffer/Default.aspx' + urlQuery ;
				parent.document.getElementById('frame_details').src=MP_Query;
				var MyDiv = document.getElementById('ACTIVECOMMANDS');
				MyDiv.style.visibility= 'visible';
				MyDiv.innerHTML = '<img src=../Images/pro-2-chkout.jpg onClick=MarketPlace_CheckOut("checkout") /> ';
				downslide();
				}	
			
			else if ( MP_Query == 'imp_cart')
			{
			
				//MODIFIED BY ASHER SYED ON 20080110 FOR ADDING PRODUCTS FROM BID
			
				
					
				//Query=imp_cart&type=controlledbid&mp_id=10&merchant_product_id=158198
				//&product_id=2037&price=73.5092&Quantity=3&bidid=2488&original_product_id=21312123
				
				var QueryType = queryString("Query");
				var type = queryString("type");
				var mp_id = queryString("mp_id");
				var merchant_product_id = queryString("merchant_product_id");
				var mp_product_id = queryString("mp_product_id");
				var price = queryString("price");
				var Quantity = queryString("Quantity");
				var bidid = queryString("bidid");
				var original_product_id = queryString("original_product_id");
				
				CurrentProductID = original_product_id;
				CurrentProductPrice = price;
				
				ShowHideProductCommands('Product', original_product_id, urlQuery, original_product_id, 'search');
				totalPriceRemover();

				RelatedProduct(original_product_id);
				downslide();
				//MP_Query= '\Shopping/impcart.aspx' + urlQuery ;
				//parent.document.getElementById('frame_details').src=MP_Query;
				//var MyDiv = document.getElementById('ACTIVECOMMANDS');
				//MyDiv.style.visibility= 'visible';
				//downslide();
				
			}	
			
			else if( MP_Query == 'infinioffice')
			{
				SetSource("../Customer/Home.aspx");
			}
			else if(MP_Query== 'ebay')
			{
			
			SetSource("Ajax/ebay.aspx?eBayLogId=" + querystring("eBayLogID"));
			}
			
		else if(queryString("qstr") == 'controlledbid')
			{
				downslide();
				RedirectPlaceBid();
			}
			else if(queryString("qstr") == 'login')
			{
				downslide();
					
				var url = "http://" + window.location.host + "/MP_AJAX/displayDescription.aspx" + GlobalMpQuery+"&checkBanner=true&_screen="+screen.width ;
				var xmlRequest = DoCallback(url,"")
				if (xmlRequest)
				{ 
					var str = xmlRequest.responseText;
						if (str=='ok')
						{
							var merchant_id =queryString("merchant_product_id");
							src ='../ProductFiles/' +merchant_id +'/1/1/resolution/index.htm';
							SetSourceWithCommands(src);
						}
						else
						{
							SetSourceWithCommands("http://" + window.location.host + "/MP_AJAX/displayDescription.aspx" + GlobalMpQuery);
						}
				} 
		
				
				var url = "http://" + window.location.host + "/MP_AJAX/MP_ProductDetails.aspx" + GlobalMpQuery ;
				var xmlRequest = DoCallback(url,"")
				if (xmlRequest)
				{ 
					var str = xmlRequest.responseText;
					var MyDiv = document.getElementById('ACTIVECOMMANDS');
					MyDiv.style.visibility= 'visible';
					MyDiv.innerHTML = str; 		
				} 
				else 
				{
					var MyDiv = document.getElementById('ACTIVECOMMANDS');
					MyDiv.style.VISIBILITY= 'visible';
					MyDiv.innerHTML = str; 		
				}
				
			}
		
			else if(MP_Query == 'true')
			{
				downslide();
				var src = queryString("productid");	
				src="\ImageHandler.ashx?imp_pid=" + src ;
				BestOfferBid();
			}
			
			else if (MP_Query=='NavigateToProductFromSupport')
			{
			NavigateToProductFromSupport(queryString("productid"));
			}
			
			
			else if( MP_Query == 'infinimarket')
			{
				downslide();
				SetSource("Mp_Ajax/Mp_login.aspx?" +  window.location.search );
			}
		}

		navigateToHome = false;
	
	
	
	
	}
}
    
   


    


function urlQuery()
{
	var hasQueryString = document.URL.indexOf('?');
	var additionalQueryString = "";
	//var targetUrl = "http://www.someURL.com/?with=queryString";
	if (hasQueryString != -1) { 
	// Create variable from ? in the url to the end of the string
	additionalQueryString = document.URL.substring(hasQueryString+1, document.URL.length);
	
	return additionalQueryString ;

	}
			
}
// Show Layer menu onMouseOver for categories 
/* Edit By Usman For Menu position position fix 10/03/2007 */

function ShowMenuCat()
{
	document.getElementById("leftbartable").style.top = topCategory - 20; 
	document.getElementById("leftbartable").style.left = leftCategory;
	/*if(advertisementVisiblity == 2)
	{
		showMenuCatWithAds();
	}
	else
	{
		showMenuWithoutAds();
	}*/
}
/* changes end By Usman For Menu position position fix 10/03/2007 */ 
// Hide Layer menu onClick 
function HideMenuCat()
{
/**
	document.getElementById("MOverMenu").style.visibility = "hidden"
	//document.getElementById("SecondTop").style.visibility = "hidden";
	if(document.getElementById("secondTop") != null && document.getElementById("secondTop").style.visibility == "visible")
	{
		document.getElementById("MOverMenu").style.visibility = "hidden"
		document.getElementById("SecondTop").style.visibility = "hidden";
	}
**/	
}
function HideMenuCatTop()
{
	//document.getElementById("MOverMenu").style.visibility = "hidden";
	//document.getElementById("SecondTop").style.visibility = "hidden";
}
// left bar link	21/12/2006	Start
function topLayerShow()
{
	// iPhone Change
	if(document.getElementById("topLink"))
	// End iPhone Change
	{
		if (document.getElementById("topLink").style.visibility == "visible")
		{
			return;
		}
		else
		{
			document.getElementById("topLink").style.visibility = "visible";
		}
	}
}
function topLayerHide()
{
	// iPhone Change
	if(document.getElementById("topLink"))
	// End iPhone Change
	{
		if (document.getElementById("topLink").style.visibility == "hidden")
		{
			return;
		}
		else
		{
			document.getElementById("topLink").style.visibility = "hidden";
		}
	}
}
function ShowHideProductCommands(type, params, queryString, ProdId, proType, proName) {
    FrameSize('');
    relatedPro_ParentID = ProdId;
    if (type == "Category") {
        UnLoadCommands();
        var xmlRequest = DoCallback(_Domain + "/Catalog/DisplayWithDetails.aspx", params);
        document.getElementById("DIV_LIST").innerHTML = xmlRequest.responseText;
    }
    if (type == "Product") {
        ProAlert = 1;
        FavproductId = ProdId;
        FavProType = "true"
        CurrentProductID = params;

        //For Product Attribute
        //renderProductAttibute(queryString);

        //LoadProductCommands(queryString);
        if (proType == "search") {
            LoadProductCommands(queryString);
            productCmdQuerry = queryString;
            //if (GetUAgentMainScript() != "") {
            LoadProductCommands(queryString, true, proName);
            //}
        }
        else if (proType == "nosearch") {
            productCmdQuerry = queryString;
            LoadProductCommands(queryString);
           // if (GetUAgentMainScript() != "") {
            LoadProductCommands(queryString, true, proName);
           // }

        }
    }
    HideBottomPagebannersNew();
    // iPhone Change
    getIPhoneIViewFor("ShowHideProductCommands");
    // End iPhone Change
}
// MENU BY SHAHZAIB END
var setTempImage;
function setTemplateImage(src)
{
	//setTempImage = src;
}
function RelatedSetSource(src)
{
	//window.frames["frame_details"].location = src;
		window.frames["frame_details"].location.replace(src);
	//StopPlayer();
	
}
/*MODIFIED BY ZEESHAN 25-03-08
---------------------------------------------------------------------------------*/
/* MODIFIED BY S.ZEESHAN FOR MULTIPLE RESOLUCTION CATEGORIES*/
function SetSource(src)
{
	
	if(window.frames["frame_details"] != undefined)
	{
		/* Modified By S.Zeeshan 25-March-2008
		/ Included a Condition for Full View Resoltion Category Files 
		-------------------------------------------------------------*/
		var catURLForFullView = CateFilesWithResoltuion(src)
		if (resizeInfiniViewWithResolution == true)
		{
				window.frames["frame_details"].location.replace(catURLForFullView);
			}else{
				window.frames["frame_details"].location.replace(src);
			}
		//------------------------------------------------------------
		// End Modification 
		UnLoadCommands();
	}
	else
	{ 
		this.location.href = src;
	//	UnLoadCommands();
	}
	//document.getElementById("DIV_LIST").style.height = "280px";
}

/*---------------------------------------------------------------------------------*/

// Asher Syed
function SetSourceWithCommands(src) {
getIPhoneIViewFor("SetSourceWithCommands");
/*if(window.frames["frame_details"].location.href)
{
	if(window.frames["frame_details"].location != null)
	{
		framehistory = window.frames["frame_details"].location.href;
	}
}*/
    if (GetUAgentMainScript() != "") {
        DisplayFrameWithCommandHideList();
        src = src.replace("resolution", "250x250")
        window.frames["frame_details"].location.replace(src);
        fullScreenIframeSrc = src;
    }
  else
  {	
	getIPhoneIViewFor("SetSourceWithCommands");
	if(USE_FILESYSTEM_PROUDCTCOMMANDS)
	{

		_screenWidthChkr =	screen.width;
		if(_screenWidthChkr >= 1280)
		{
			src = src.replace("resolution","1280x1024")
			//window.frames["frame_details"].location = src;
			window.frames["frame_details"].location.replace(src);
			fullScreenIframeSrc = src;
		}
		else if(_screenWidthChkr >= 1024 && _screenWidthChkr < 1280)
		{
			src = src.replace("resolution","1024x768")
			//window.frames["frame_details"].location = src;
			window.frames["frame_details"].location.replace(src);
			fullScreenIframeSrc = src;
		}
		else if(_screenWidthChkr >= 800 && _screenWidthChkr < 1024)
		{
			src = src.replace("resolution","800x600")
			//window.frames["frame_details"].location = src;
			window.frames["frame_details"].location.replace(src);
			fullScreenIframeSrc = src;
		}
	}
	else
	{
		//window.frames["frame_details"].location = src;
		window.frames["frame_details"].location.replace(src);
		return;
	}
  }
	//window.frames["frame_details"].location = src;
  //UnLoadCommands();

}

function LoadAudioPlayer(src)
{
	var xmlRequest = DoCallback(_Domain + "/" + src, "");
	var AudioPlayer = document.getElementById("AudioPlayer");
	if (AudioPlayer != null)
	{
		document.getElementById("AudioPlayer").innerHTML = xmlRequest.responseText;
		SetAudioPlayerSoundStatus();
	}
}

function SetObjectSize(object, width, height)
{
	// iPhone Change
	//document.getElementById(object).style.width = width;
    //document.getElementById(object).style.height = height;
    if (GetUAgentMainScript() != "") {
        document.getElementById(object).style.width = getDynamicTransform("SetObjectSize", width, height)['width'];
        document.getElementById(object).style.height = getDynamicTransform("SetObjectSize", width, height)['height'];
    }
	// end iPhone Change
}
//function DoCallback(url, params, waitingIds)
function DoCallback(url, params)
{

var pageUrl = url + params;
	var xmlRequest;
	var xmlRequest;
	try{  
		// Firefox, Opera 8.0+, Safari
		xmlRequest=new XMLHttpRequest();  
		}
	catch (e){  
			// Internet Explorer  
			
			try	{    
				xmlRequest=new ActiveXObject("Msxml2.XMLHTTP");    
				}
	catch (e){    
			try{
				xmlRequest=new ActiveXObject("Microsoft.XMLHTTP");      
				}
    catch (e){      
				alert("Your browser does not support AJAX!");      
				return false;      
				}
			}  
		}
	// Commented By zeeshan for Cellphone optimization on  - 4 oct 2010
	//xmlRequest.open("POST", pageUrl, false);
	//xmlRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlRequest.open("GET", pageUrl, false);
	xmlRequest.send("");
	return xmlRequest;
	
}


function buyProductPross()
{
	var req=null;
	req=initXMLHTTPRequest();
	if (req)
	{
		req.open("POST","AJAX/RelatedProductWizard.aspx?currentProduct="+ CurrentProductID,true);
		req.onreadystatechange=function()
		{
			var ready=req.readyState;
			var data=null;
			if (ready==4)
			{
				//xmlResult = req.responseText;
				//document.getElementById("relatedPro").innerHTML=xmlResult;
				ShowQuestionsNew();
			}
			else
			{
				SetSource("/loadingpage.html");
				relatedProductBarHide();
				//document.getElementById("relatedPro").innerHTML = "";
				//document.getElementById("relatedPro").innerHTML=frameLoading;
			}
		}
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		req.send("");
	}
}
/*function ShowQuestionsWithRelated(CurrentProductIDRelated)
{
	
}*/
function callRelatedShowcase()
{
	if(relatedProductLength.length > 0 )
	{
		if (relatedProductLength[0] != null)
		{
			currentRelatedProduct = relatedProductLength[0];
			CurrentProductID = currentRelatedProduct;
			ShowQuestionsRelated(currentRelatedProduct)
			relatedProductLength.splice(0,1);
		}
		else
		{
			relatedProductLength.splice(0,1);
		}	
	}
}
function ShowQuestionsRelated(RelatedProduct)
{
	var url = "AJAX/WizardSelector.aspx?product_id=" + RelatedProduct;
	SetSource(url);
	spaceRowVis();
	stop();
}
function ShowQuestions()
{
	ProAlert = 0;
	var url = "AJAX/WizardSelector.aspx?product_id=" + CurrentProductID;
	SetSource(url);
	spaceRowVis();
	stop();
}
function ShowQuestionsFileSystem(prodId)
{
	var url = "../../../../../AJAX/WizardSelector.aspx?product_id=" + prodId;
	SetSource(url);
	spaceRowVis();
	stop();
}
function ShowWizard()
{
	var url = "AJAX/ProductConfigWizard.aspx?product_id=" + CurrentProductID;
	SetSource(url);
	
}
function LoadProductCommands(QueryString, TabsLayout, ProName) {
  
    var CommandContainer;
    var URL;
    if (TabsLayout) {
        //QueryString = QueryString + uAgent;
        QueryString = QueryString + uAgent + "&Tabs=Y";
        CommandContainer = GlobalObject("ACTIVECOMMANDS_TABS");
      
        URL = _Domain + "/AJAX/ProductCommandsFSTabs.aspx";
    } else {
        QueryString = QueryString + uAgent;
        CommandContainer = GlobalObject("ACTIVECOMMANDS");
        URL = _Domain + "/AJAX/ProductCommandsFS.aspx";
    }


    CommandContainer.style.display = 'block';
    CommandContainer.style.visibility = 'visible';
    //CommandContainer.innerHTML = loadPagesImageNewCenter;


    //QueryString = QueryString + uAgent;
    //var xmlRequest = DoCallback("AJAX/ProductCommands.aspx", queryString);
    //document.getElementById("ACTIVECOMMANDS").innerHTML = xmlRequest.responseText;
    /*if(document.getElementById("ACTIVECOMMANDS").style.visibility = 'visible')
    {
    return;
    }
    else
    {
    document.getElementById("ACTIVECOMMANDS").style.visibility = 'visible';
    }*/

    //document.getElementById("ACTIVECOMMANDS").style.visibility = 'visible';
    //document.getElementById("ACTIVECOMMANDS").innerHTML = loadPagesImageNewCenter;

    //GlobalObject("ACTIVECOMMANDS").style.display = 'block';
    // GlobalObject("ACTIVECOMMANDS").style.visibility = 'visible';
    //GlobalObject("ACTIVECOMMANDS").innerHTML = loadPagesImageNewCenter;


    var req = null;
    req = initXMLHTTPRequest();
    if (req) {

        if (USE_DATABASE_PRODUCTCOMMANDS) {
            //req.open("GET",_Domain + "/AJAX/ProductCommands.aspx" + QueryString,true);
            req.open("POST", URL + QueryString, true);
        }
        if (USE_FILESYSTEM_PROUDCTCOMMANDS) {
            //req.open("POST",_Domain + "/AJAX/ProductCommandsFS.aspx" + QueryString,true);
            if (WORKFLOW_PRODUCT == true && WORKFLOW_PRODUCT_MANDATORY == 1) {
                if (parseInt(WORKFLOW_PARENT_PRODUCT[WORKFLOW_PARENT_PRODUCT.length - 1]) == WORKFLOW_PRODUCT_CURRENT) {
                    QueryString = QueryString + "&workflow_product=1&mandatory=" + WORKFLOW_PRODUCT_MANDATORY.toString() + "&ForceCommands=true";
                }
                else {
                    QueryString = QueryString + "&workflow_product=1&mandatory=" + WORKFLOW_PRODUCT_MANDATORY.toString();
                }

                req.open("GET", _Domain + "/AJAX/ProductCommandsFS.aspx" + QueryString, true);
            }
            else if (WORKFLOW_PRODUCT == true && WORKFLOW_PRODUCT_MANDATORY == 0) {
                if (parseInt(WORKFLOW_PARENT_PRODUCT[WORKFLOW_PARENT_PRODUCT.length - 1]) == WORKFLOW_PRODUCT_CURRENT) {
                    QueryString = QueryString + "&workflow_product=1&mandatory=" + WORKFLOW_PRODUCT_MANDATORY.toString() + "&ForceCommands=true";
                }
                else {
                    QueryString = QueryString + "&workflow_product=1&mandatory=" + WORKFLOW_PRODUCT_MANDATORY.toString();
                }

                //req.open("GET",_Domain + "/AJAX/ProductCommandsFS.aspx" + QueryString,true);
                req.open("GET", URL + QueryString, true);
            }
            else {
                //req.open("GET",_Domain + "/AJAX/ProductCommandsFS.aspx" + QueryString,true);
                req.open("GET", URL + QueryString, true);
            }
        }

        req.onreadystatechange = function() {

            var ready = req.readyState;
            var data = null;
            if (ready == 4) {

                xmlResult = req.responseText;

                //document.getElementById("ACTIVECOMMANDS").innerHTML = "";
                //document.getElementById("ACTIVECOMMANDS").innerHTML = xmlResult;

                //GlobalObject("ACTIVECOMMANDS").innerHTML = "";
                //GlobalObject("ACTIVECOMMANDS").innerHTML = xmlResult;
                CommandContainer.innerHTML = "";
                CommandContainer.innerHTML = xmlResult;


                if (ProName) {
                    GlobalObject("_ProName").innerHTML = ProName;
                }

                if (USE_DATABASE_PRODUCTCOMMANDS) {
                    CycleFile();
                    LoadSlideShowCommands();
                }
                if (USE_FILESYSTEM_PROUDCTCOMMANDS) {
                    _ProductCommands = new ProductCommands(CurrentProductID);
                    //var ProductType = document.getElementById("PRODUCT_TYPE");
                    var ProductType = GlobalObject("PRODUCT_TYPE");
                    //if(document.getElementById("buybt").innerHTML == "")
                    
                    if (ProductType != null) {

                        switch (ProductType.innerHTML) {
                            case "NORMAL":
                                //alert(document.getElementById("WizardType").innerHTML);
                                if (document.getElementById("WizardType").innerHTML == "CONFIGURE") {
                                    ProductCommands_FileSystem_Init_Configure();
                                    document.getElementById("PriceRow").style.visibility = 'hidden';
                                    scriptToRunOnPopState = "ProductCommands_FileSystem_Init_Configure();"

                                }
                                else {
                                    ProductCommands_FileSystem_Init();
                                    scriptToRunOnPopState = "ProductCommands_FileSystem_Init();"
                                }

                                //ProductCommands_FileSystem_Init();	
                                break;
                            case "BUYER":
                                ProductCommands_FileSystem_Init_Buyer();
                                scriptToRunOnPopState = "ProductCommands_FileSystem_Init_Buyer();"
                                break;
                            case "AP":
                                ProductCommands_FileSystem_Init2();
                                scriptToRunOnPopState = "ProductCommands_FileSystem_Init2();"
                                break;
                            case "AP_WITHBUY":
                                ProductCommands_FileSystem_Init3();
                                scriptToRunOnPopState = "ProductCommands_FileSystem_Init3();"
                                break;
                            case "HR_PRODUCT":
                                /* var ProductCategory = GetQueryStringValue(QueryString,"ProductCategory");
                                if (ProductCategory == "HR_PRODUCT")
                                {
                                ProductCommands_FileSystem_Init4(ProductCategory);	
                                } */
                                var ProductCategory = 'HR_PRODUCT';
                                ProductCommands_FileSystem_Init4(ProductCategory);
                                break;
                            case "WORKFLOW_PRODUCT":
                                ProductCommands_FileSystem_Init5();
                                scriptToRunOnPopState = "ProductCommands_FileSystem_Init5();"
                                break;
                            case "BOOKING":
                                ProductCommands_FileSystem_Init_Booking();
                                scriptToRunOnPopState = "ProductCommands_FileSystem_Init_Booking();"
                                break;
                        }
                    }
                    //ProductCommands_FileSystem_Init();
                }
            }
            else {
                //document.getElementById("ACTIVECOMMANDS").innerHTML=frameLoading;
            }
        }
        //req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        req.send("");
    }
}

function LoadProductCommandsTabs(QueryString, ProName) {

    QueryString = QueryString + uAgent;
    var ContainerID = "ACTIVECOMMANDS_TABS";
    var URL = _Domain + "/AJAX/ProductCommandsFSTabs.aspx" + QueryString;
    GlobalObject(ContainerID).style.display = 'block';
    GlobalObject(ContainerID).style.visibility = 'visible';
    GlobalObject(ContainerID).innerHTML = loadPagesImageNewCenter;

    var req = null;
    req = initXMLHTTPRequest();
    if (req) {

        if (USE_DATABASE_PRODUCTCOMMANDS) {
            req.open("POST", _Domain + "/AJAX/ProductCommands.aspx" + QueryString, true);
        }
        if (USE_FILESYSTEM_PROUDCTCOMMANDS) {
            if (WORKFLOW_PRODUCT == true && WORKFLOW_PRODUCT_MANDATORY == 1) {
                if (parseInt(WORKFLOW_PARENT_PRODUCT[WORKFLOW_PARENT_PRODUCT.length - 1]) == WORKFLOW_PRODUCT_CURRENT) {
                    QueryString = QueryString + "&workflow_product=1&mandatory=" + WORKFLOW_PRODUCT_MANDATORY.toString() + "&ForceCommands=true";
                }
                else {
                    QueryString = QueryString + "&workflow_product=1&mandatory=" + WORKFLOW_PRODUCT_MANDATORY.toString();
                }
                req.open("GET", URL, true);
            }
            else if (WORKFLOW_PRODUCT == true && WORKFLOW_PRODUCT_MANDATORY == 0) {
                if (parseInt(WORKFLOW_PARENT_PRODUCT[WORKFLOW_PARENT_PRODUCT.length - 1]) == WORKFLOW_PRODUCT_CURRENT) {
                    QueryString = QueryString + "&workflow_product=1&mandatory=" + WORKFLOW_PRODUCT_MANDATORY.toString() + "&ForceCommands=true";
                }
                else {
                    QueryString = QueryString + "&workflow_product=1&mandatory=" + WORKFLOW_PRODUCT_MANDATORY.toString();
                }

                req.open("GET", URL, true);
            }
            else {
                req.open("GET", URL, true);
            }
        }

        req.onreadystatechange = function() {

            var ready = req.readyState;
            var data = null;
            if (ready == 4) {
                xmlResult = req.responseText;
                GlobalObject(ContainerID).innerHTML = "";
                GlobalObject(ContainerID).innerHTML = xmlResult;
                if (ProName) {
                    GlobalObject("_ProName").innerHTML = ProName;
                }

                if (USE_DATABASE_PRODUCTCOMMANDS) {
                    CycleFile();
                    LoadSlideShowCommands();
                }
                if (USE_FILESYSTEM_PROUDCTCOMMANDS) {
                    _ProductCommands = new ProductCommands(CurrentProductID);
                    var ProductType = GlobalObject("PRODUCT_TYPE");
                    if (GlobalObject("buybt").innerHTML == "") {
                        downslidetwo();
                    }
                    if (ProductType != null) {

                        switch (ProductType.innerHTML) {
                            case "NORMAL":
                                if (document.getElementById("WizardType").innerHTML == "CONFIGURE") {
                                    ProductCommands_FileSystem_Init_Configure();
                                    document.getElementById("PriceRow").style.visibility = 'hidden';

                                }
                                else {
                                    ProductCommands_FileSystem_Init();
                                }
                                break;
                            case "BUYER":
                                ProductCommands_FileSystem_Init_Buyer();
                                break;
                            case "AP":
                                ProductCommands_FileSystem_Init2();
                                break;
                            case "AP_WITHBUY":
                                ProductCommands_FileSystem_Init3();
                                break;
                            case "HR_PRODUCT":
                                var ProductCategory = 'HR_PRODUCT';
                                ProductCommands_FileSystem_Init4(ProductCategory);
                                break;
                            case "WORKFLOW_PRODUCT":
                                ProductCommands_FileSystem_Init5();
                                break;
                        }

                    }
                }
            }
            else {
            }
        }
        req.send("");
    }
}

function ProcessProductCommand(arg)
{
	
	if (arg == "buy")
	{
		LoadCartCommands();
	}
}
function LoadQuestionCommands()
{
    var myDate = new Date();
    var myTime = myDate.getTime();
    var xmlRequest = DoCallback(_Domain + "/AJAX/QuestionCommands.aspx?t=" + myTime, "");
	document.getElementById("ACTIVECOMMANDS").innerHTML = xmlRequest.responseText;
	document.getElementById("ACTIVECOMMANDS").style.visibility = 'visible';
}
var relProductCart;
function fakeAlert()
{
	SetSource(relProductCart);
	setTimeout("simplecallme()",2000);
}
function fileSystemCall(productId,wizname)
{
	
	//this.location.href = "http://" + window.location.host + "/AJAX/WizardSelector.aspx?product_id="+productId+"&required_name="+wizname;
	_ProductCommands.SlideShowCommands.ClearTimer();
	SetSource("http://" + window.location.host + "/AJAX/WizardSelector.aspx?product_id="+productId+"&required_name="+wizname);
}
function LoadCartCommands()
{
	stop();
	var tt;
	var xmlRequest = DoCallback(_Domain + "/AJAX/CartCommands.aspx", "");
	var ACTIVECOMMANDS = GetElement("ACTIVECOMMANDS");
	ACTIVECOMMANDS.style.visibility = 'visible';
	ACTIVECOMMANDS.style.display = 'block';
	ACTIVECOMMANDS.innerHTML = xmlRequest.responseText;
	relatedProductBarHide();
	//GetElement("RelatedProductNextButton").style.display = "none";
	GetElement("CheckoutButton").style.display = "block";
	/*if (GetElement("FavouriteProductDiv").style.display == "block")
	{
	    GetElement("FavouriteProductDiv").style.display = "none";
	}*/
	removeElement("FavouriteProductDiv", "SUB_CATEGORIES", "RelatedProductNextButton");
	if(relatedProductLength.length > 0 )
	{
		//SetSource(frameLoading);
		SetSource("/loadingpage.html");
		var lengArray;
		lengArray = relatedProductLength.length;
		for(tt=0;tt<lengArray;tt++)
		{
		
			if (relatedProductLength[0] != null)
			{
				currentRelatedProduct = relatedProductLength[0];
				var xmlRequest = DoCallback(_Domain + "/Shopping/cart.aspx?add2cart=true&product_id=" + currentRelatedProduct,"")
				relatedProductLength.splice(0,1);
			}
			else
			{
				relatedProductLength.splice(0,1);
			}	
		}
		SetSource("../Shopping/cart.aspx");
		ShowCartButton();
	}
	/*if(relatedProductLength.length > 0 )
	{
		//SetSource(frameLoading);
		SetSource("/loadingpage.html");
		var lengArray;
		lengArray = relatedProductLength.length;
		for(tt=0;tt<lengArray;tt++)
		{
		
			if (relatedProductLength[0] != null)
			{
				currentRelatedProduct = relatedProductLength[0];
				//var xmlRequest = DoCallback("/Shopping/cart.aspx?add2cart=true&product_id=" + currentRelatedProduct,"");
				relatedProductLength.splice(0,1);
				CurrentProductID = currentRelatedProduct;
				ShowHideProductCommands('Product', currentRelatedProduct, '?product_id='+currentRelatedProduct, currentRelatedProduct, 'search');
				_ProductCommands.BuyProduct();
			}
			else
			{
				relatedProductLength.splice(0,1);
			}	
		}
		SetSource("../Shopping/cart.aspx");
		ShowCartButton();
	}*/
	if (WORKFLOW_PRODUCT){Workflow_LoadNextProduct();}
		else{
			Workflow_ClearContainer();
		}
	ShowCartButton();
	/*if(relatedProductLength.length > 0)
	{
		document.getElementById("RelatedProductNextButton").style.display = "block";
		document.getElementById("CheckoutButton").style.display = "none";
	}
	else
	{
		document.getElementById("CheckoutButton").style.display = "block";
		document.getElementById("RelatedProductNextButton").style.display = "none";
	}*/
	//DONE BY ASHER SYED FOR SHOWING CART BUTTON
}
function LoadMPCartCommands()
{
	var xmlRequest = DoCallback(_Domain + "/MP_AJAX/CartCommands.aspx", "");
	document.getElementById("ACTIVECOMMANDS").style.visibility = 'visible';
	document.getElementById("ACTIVECOMMANDS").innerHTML = xmlRequest.responseText;
	relatedProductBarHide();
}
// Asher
function LoadSlideShowCommands()
{
	var xmlRequest = DoCallback(_Domain + "/AJAX/SlideShowCommands.aspx", "");
	var SlideShowCommands = document.getElementById("SlideShowCommands");
	
	if (SlideShowCommands != null)
	{
		SlideShowCommands.style.visibility = 'visible';
		SlideShowCommands.innerHTML = xmlRequest.responseText;
		RenderImageCount();
		LoadSlider();
	}
}
// End
function ProcessCartCommand(arg)
{

if (arg == "get_equote")
{
window.top.frames["frame_details"].SetArgument(arg);
window.top.frames["frame_details"].Submit();
UnLoadCommands();
}
if (arg == "update_total")
{
window.top.frames["frame_details"].SetArgument(arg);
window.top.frames["frame_details"].Submit();
UnLoadCommands();
}
if (arg == "checkout")
{
window.top.frames["frame_details"].SetArgument(arg);
window.top.frames["frame_details"].Submit();
Workflow_ClearContainer();
UnLoadCommands();
}
if (arg == "continue_shop")
	{
	if (typeof(window.top.frames["frame_details"].Page_IsValid) != 'undefined' )
		{
			if (window.top.frames["frame_details"].Page_IsValid == null)
			{
				window.top.frames["frame_details"].SetArgument(arg);
				window.top.frames["frame_details"].Submit();
				UnLoadCommands();		
			}
			if (window.top.frames["frame_details"].Page_IsValid != null && window.top.frames["frame_details"].Page_IsValid)
			{
				window.top.frames["frame_details"].SetArgument(arg);
				window.top.frames["frame_details"].Submit();
				UnLoadCommands();
			}
			else {
			    if (GetUAgentMainScript() != "") {

			        window.top.frames["frame_details"].SetArgument(arg);
			        window.top.frames["frame_details"].Submit();
			        UnLoadCommands();

			    }
			    else {
			        if (window.top.frames["frame_details"].CheckRequiredFieldValidators()) {
			            window.top.frames["frame_details"].SetArgument(arg);
			            window.top.frames["frame_details"].Submit();
			            UnLoadCommands();
			        }
			    }
			}				
		} 
		else
		{
			window.top.frames["frame_details"].SetArgument(arg);
			window.top.frames["frame_details"].Submit();
			UnLoadCommands();		
		}

	}	
if (arg == "google_checkout")
{
window.top.frames["frame_details"].SetArgument(arg);
window.top.frames["frame_details"].Submit();
UnLoadCartCommands();
}
}
function ProcessWizardCommand(arg)
{
	window.top.frames["frame_details"].SetArgument(arg);
	window.top.frames["frame_details"].Submit();
	
}
// Start new
function GetXmlHttpObject()
{
	var browser_type=navigator.appName
	var xmlHttp=null;
	var browser_version=parseInt(navigator.appVersion)
	
	if (browser_type=="Microsoft Internet Explorer"&&browser_version>=4)
	{
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	else 
	{
		xmlHttp=new XMLHttpRequest();
	}
	return xmlHttp;
}


function stateChanged() 
{ 
	if (xmlHttp.readyState==4)
	{ 
		xmlResult = xmlHttp.responseText;
		document.getElementById("DIV_LIST").innerHTML = xmlResult;
		if(xmlResult.length > 500)
		{
			//////////////////////SetObjectSize("frame_details", 546, 235);
			SetObjectSize("DIV_LIST", 226, 226);
			initArrow('searchRes');
			topLayerShow();
			//srchTopFirstLvl();
			simpleTopVar = "showSrch";
			spaceRowVis();
			downslidetwo();
			var StringToMatch = /AJAX\/ItemImage.aspx\?type=Product\&amp;item_id=\d+/;
			var firstProduct = MatchString(xmlResult, StringToMatch);
			document.getElementById("stackText").innerHTML = "";
			SetSource(mainPagePic);
		}
		else
		{
			//initArrow('searchRes');
			topLayerShow();
			simpleTopVar = "showSrchnoRec";
			//srchTopFirstLvl();
			spaceRowVis();
			var StringToMatch = /AJAX\/ItemImage.aspx\?type=Product\&amp;item_id=\d+/;
			var firstProduct = MatchString(xmlResult, StringToMatch);
			document.getElementById("stackText").innerHTML = "";
			SetSource(mainPagePic);
		}	
	
		if (firstProduct != null)
		{
			if (USE_DATABASE_PRODUCTCOMMANDS)
			{
				SetSource(firstProduct);
			}
			if (USE_FILESYSTEM_PROUDCTCOMMANDS)
			{
				var tempStrLenth = firstProduct.length;
				var tempStrStart = firstProduct.lastIndexOf('=');
				tempStrStart = tempStrStart + 1
				firstProduct = firstProduct.substring(tempStrStart,tempStrLenth);
				SetSourceWithCommands('../ProductFiles/'+firstProduct+'/1/1/resolution/index.htm');
				fullScreenImage = '../ProductFiles/'+firstProduct+'/1/1/resolution/index.htm';
				
				//req.open("POST","AJAX/ProductCommandsFS.aspx" + queryString,false);
			}
			
			//LoadBottom();
		}
		else
		{
			SetSource("BlankPage.htm")
			//LoadBottom();
		}
	}
	else if(xmlHttp.readyState==3)
	{
		//document.getElementById("DIV_LIST").innerHTML = "<img src='/images/cat_img/new/circle-ball-dark-antialiased.gif' />";
		document.getElementById("DIV_LIST").innerHTML = "<table width='100%' height='200' border='0' cellpadding='0' cellspacing='0'><tr><td align='center' valign='bottom' class='favheadertext'>Searching..</td></tr><tr><td align='center' valign='top'>"+loadPagesImage+"</td></tr></table>";
		document.getElementById("stackText").innerHTML = "";
		SetSource("/loadingpage.html");
		SetSource(mainPagePic);
	}
}


function stateChanged_WAP() {
    if (xmlHttp.readyState == 4) {
        xmlResult = xmlHttp.responseText;
        document.getElementById("DIV_LIST").innerHTML = xmlResult;
      //  $("#DIV_LIST:hidden").removeAttr('style').hide().fadeIn();
     //   $("#DIV_LIST").effect('slide', '', 700, '');
        //$("#content").overscroll();
        if (xmlResult.length > 500) {
            //////////////////////SetObjectSize("frame_details", 546, 235);
            
            //initArrow('searchRes');
            
            //srchTopFirstLvl();
            simpleTopVar = "showSrch";
            
            var StringToMatch = /AJAX\/ItemImage.aspx\?type=Product\&amp;item_id=\d+/;
            var firstProduct = MatchString(xmlResult, StringToMatch);
            
        }
        else {
            //initArrow('searchRes');
            
            simpleTopVar = "showSrchnoRec";
            //srchTopFirstLvl();
            
            var StringToMatch = /AJAX\/ItemImage.aspx\?type=Product\&amp;item_id=\d+/;
            var firstProduct = MatchString(xmlResult, StringToMatch);
            
        }

        
    }
    else if (xmlHttp.readyState == 3) {
        //document.getElementById("DIV_LIST").innerHTML = "<img src='/images/cat_img/new/circle-ball-dark-antialiased.gif' />";
        document.getElementById("DIV_LIST").innerHTML = "<table width='100%' height='200' border='0' cellpadding='0' cellspacing='0'><tr><td align='center' valign='bottom' class='favheadertext'>Searching..</td></tr><tr><td align='center' valign='top'>" + loadPagesImage + "</td></tr></table>";
       
    }
}


//	End new
function SearchProducts()
{
    if (CategorySearchAtInfiniview) {
        SearchProductAtInfiniView();
    }
    else {
	RestoreScreenWindow('');
	hideWorkFlow();
	FrameSize('');
	hideFavRight();
	hideHistoryRight();
	document.getElementById("leftbartable").style.display = 'block';
	document.getElementById("DIV_LIST").style.display='block'
	document.getElementById("DIV_LIST").style.visibility='visible'
	document.getElementById("DIV_LIST").innerHTML = "<table width='100%' height='200' border='0' cellpadding='0' cellspacing='0'><tr><td align='center' valign='bottom' class='favheadertext'>Searching..</td></tr><tr><td align='center' valign='top'>"+loadPagesImageCenter+"</td></tr></table>";
	myMainCategoryMoving();
	slidebox('slidebox1');
	textbar('textbarcol'); 
	relatedProductBarHide();
	stop();
	var xmlResult;
	var iChars = "!@#$%^*()+=<-[]\\\`~';,./{}|\":>&?";
	var textboxValue;
	textboxValue = document.getElementById("ProductSearch1_searchtxt").value;
	for (var i = 0; i < textboxValue.length; i++)
	{
  		if (iChars.indexOf(textboxValue.charAt(i)) != -1) 
		{
			textboxValue = "error"
  			var queryString = "?ProductSearch=" + textboxValue;
			xmlHttp=GetXmlHttpObject();
			if (xmlHttp==null)
			{
				alert ("Your browser does not support AJAX!");
				return;
			} 
			xmlHttp.onreadystatechange=stateChanged;
			xmlHttp.open("GET","AJAX/ProductDisplay.aspx"+queryString,true);
			xmlHttp.send("");
  			return false;
  		}
	}
	if(document.getElementById("ProductSearch1_searchtxt").value == "")
	{
		var queryString = "?ProductSearch=" + document.getElementById("ProductSearch1_searchtxt").value;
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		} 
		xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.open("GET","AJAX/ProductDisplay.aspx"+queryString,true);
		xmlHttp.send("");
	}
	else if(document.getElementById("ProductSearch1_searchtxt").value != "")
  	{
  		textboxValue = document.getElementById("ProductSearch1_searchtxt").value;
		var queryString = "?ProductSearch=" + textboxValue;
		//var xmlRequest = DoCallback("AJAX/ProductDisplay.aspx", queryString);
	
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null)
		{
			alert ("Your browser does not support AJAX!");
			return;
		} 
		xmlHttp.onreadystatechange=stateChanged;
		xmlHttp.open("GET","AJAX/ProductDisplay.aspx"+queryString,true);
		xmlHttp.send("");
}

}
document.getElementById("ProductSearch1_searchtxt").value = ""
}
function SearchProducts_WAP() {

    hideFavRight();
    document.getElementById("frame_details").src = ""
    document.getElementById("leftbartable").style.display = 'block';
    document.getElementById("DIV_LIST").style.display = 'block'
    document.getElementById("DIV_LIST").style.visibility = 'visible'
    document.getElementById("DIV_LIST").innerHTML = "<table width='100%' height='200' border='0' cellpadding='0' cellspacing='0'><tr><td align='center' valign='bottom' class='favheadertext'>Searching..</td></tr><tr><td align='center' valign='top'>" + loadPagesImageCenter + "</td></tr></table>";
    relatedProductBarHide();
    UnLoadCommands();
    var txt = document.getElementById("ProductSearch1_searchtxt").value
    var searchText = (arguments.length > 0 && txt == "") ? arguments[0] : txt;
   var xmlResult;
    var iChars = "!@#$%^*()+=<-[]\\\`~';,./{}|\":>&?";
    var textboxValue = searchText;
    var RedirectURL;
    var queryString;
   // textboxValue = document.getElementById("ProductSearch1_searchtxt").value;
    for (var i = 0; i < textboxValue.length; i++) {
        if (iChars.indexOf(textboxValue.charAt(i)) != -1) {
            
            textboxValue = "error"
            queryString = "?ProductSearch=" + textboxValue;
            
//            xmlHttp = GetXmlHttpObject();
//            if (xmlHttp == null) {
//                alert("Your browser does not support AJAX!");
//                return;
//            }
//            xmlHttp.onreadystatechange = stateChanged_WAP
//            xmlHttp.open("GET", "AJAX/ProductDisplay.aspx" + queryString, true);
//            xmlHttp.send("");
//            return false;
        }
    }
    if (textboxValue == "") {
        queryString = "?ProductSearch=" + textboxValue;
//        xmlHttp = GetXmlHttpObject();
//        if (xmlHttp == null) {
//            alert("Your browser does not support AJAX!");
//            return;
//        }
//        xmlHttp.onreadystatechange = stateChanged_WAP
//        xmlHttp.open("GET", "AJAX/ProductDisplay.aspx" + queryString, true);
//        xmlHttp.send("");
    }
    else if (textboxValue != "") {
   // textboxValue = textboxValue;
        queryString = "?ProductSearch=" + textboxValue;
        //var xmlRequest = DoCallback("AJAX/ProductDisplay.aspx", queryString);

//        xmlHttp = GetXmlHttpObject();
//        if (xmlHttp == null) {
//            alert("Your browser does not support AJAX!");
//            return;
//        }
//        xmlHttp.onreadystatechange = stateChanged_WAP
//        xmlHttp.open("GET", "AJAX/ProductDisplay.aspx" + queryString, true);
//        xmlHttp.send("");
    }
    var requestURL = window.location.protocol + '//' + window.location.host + '/AJAX/ProductDisplay.aspx' + queryString;
    parent.window.frames["frame_details"].location.replace(requestURL);
    DisplayFrameWithCommandHideList();
    document.getElementById("ProductSearch1_searchtxt").value = ""
}

function MatchString(SourceString, StringToMatch) 
{

  var re = new RegExp(StringToMatch);
  var m = re.exec(SourceString);
  
  if (m == null) 
  {
  } 
  else 
  {
    var s = "";
    for (i = 0; i < m.length; i++) 
    {
      s = s + m[i] + "\n";
    }
    return s;
  }
}

function UnLoadCommands()
{
	//document.getElementById("ACTIVECOMMANDS").style.visibility = 'hidden';
	//document.getElementById("ACTIVECOMMANDS").innerHTML = "";


    removeElement("ACTIVECOMMANDS","_TabsContainer", "SlidePagingContainer");
     
	if (CurrentProductID != 0)
	{
		var _document = null;
		try
		{
			_document = window.frames["frame_ProductFilesFS"].window.document;
			if (_document != null)
			{
				window.frames["frame_ProductFiles"].MediaFiles = null;
				window.frames["frame_ProductFiles"].AudioFiles = null;
			}
		}
		catch(err)
		{
		
		}
	}	
	
}
function ShowShoppingCart(url)
{
    if (GetUserAgent() != "") {
        if (document.getElementById('LogoTable')) {
            document.getElementById('LogoTable').style.display = 'none';
            //document.getElementById('ACTIVECOMMANDS').style.display = '';
        }
        FrameSize(''); 
    }
	SetSource(url);
	LoadCartCommands();	
}






function movepic(img_name,img_src) 
{
  document.getElementById(img_name).src=img_src;
}

function refresh() {
    if (GetUAgentMainScript() != "") {
        navigateToHome = true;
        document.getElementById("FavouriteProductDiv").style.display = 'none';
        stop();
        relatedProductBarHide();
        myaccountopen();
        //CatLoadCaller();
        //CatgeoryMenuSingle();
        MainCategory();
        //getIPhoneIViewFor("refresh");
        DisplayListHideFrameWithCommand();
    }
    else {

        if (document.getElementById("stack_next")) {
            document.getElementById("stack_next").style.display = "none";
        }
        if (document.getElementById("stack_back")) {
            document.getElementById("stack_back").style.display = "none";
        }
        hideWorkFlow();
        FrameSize('large');
        if (PreviewControl == false) {
            _mainCateId = null;
        }

        //clearqry();
        navigateToHome = true;
        ProtdArr = 0;
        document.getElementById("DIV_LIST").innerHTML = "";
        if (catComView.toLowerCase() == "topper") {
            document.getElementById("leftbartable").style.display = 'none';
        }
        else {
            document.getElementById("leftbartable").style.display = 'block';
        }
        document.getElementById("FavouriteProductDiv").style.display = 'none';
        document.getElementById("HistoryProductDiv").style.display = "none";
        document.getElementById("showChatRoom_PHP").style.display = "none";
        stop();
        relatedProductBarHide();
        downslidetwo();
        //HideMenuCat();
        myaccountopen();
        //topLayerHide();... 
        nullAllVar();
        nullMainCatVar();
        ArrayColorRemove();
        document.getElementById("stackText").innerHTML = "";
        CatLoadCaller();
        CheckBottombannerNew();
        // iPhone Change
        getIPhoneIViewFor("refresh");
        // end iPhone Change
    }
}
/**

function clearqry()
{
	
	var URLn;
	URLn = self.location.protocol+'//' +self.location.host +self.location.pathname;
	var sURL = unescape(URLn);
	window.location.href = sURL;
	window.location.replace( sURL );
	window.location.reload( true );
}

**/
function DisplayPage(url)
{

	var xmlResult;
	var xmlRequest = DoCallback(_Domain + "/" + url, "");
	xmlResult = xmlRequest.responseText;
		
	var regSignIn = /signin/;
	var regHome = /home/;
	
	var strSignIn = "signin";
	var strHome = "home";
	
	var pageTitle = MatchString(xmlResult, regSignIn);
	if (pageTitle == null)
	{
		pageTitle = MatchString(xmlResult, regHome);
	}
	
	if (pageTitle.indexOf(strSignIn) == 0)
	{
		SetSource(url);	
	}
	if (pageTitle.indexOf(strHome) == 0)
	{
		document.write(xmlResult);
	}
	
}

function ShowCartButton() {
    
    if(GetUserAgent()!="")
    {
        GetElement("img_cart").style.visibility = 'visible';
    }
    GetElement("ShopCounter").style.visibility = 'visible';

}
function HideCartButton() {
    GetElement("img_cart").style.visibility = 'hidden';
    GetElement("ShopCounter").style.visibility = 'hidden';
    UnLoadCommands();
}

function getQueryVariable(variable)
{

	//var qsVariable = /variable=\D+\&amp/;
	//var qsValue = MatchString(window.location.search, StringToMatch);
	//return qsValue;

	var query = window.location.search.substring(1);
	var vars = query.split("&");
	for (var i=0; i < vars.length; i++) 
	{
		var pair = vars[i].split("=");
		if (pair[0] == variable) 
		{
			return pair[1];
		}
	} 
}

function PageQuery(q) 
{
	if(q.length > 1) this.q = q.substring(1, q.length);
	else this.q = null;
	this.keyValuePairs = new Array();
	if(q) {
		for(var i=0; i < this.q.split("&").length; i++) {
			this.keyValuePairs[i] = this.q.split("&")[i];
		}
	}
	this.getKeyValuePairs = function() { return this.keyValuePairs; }
	this.getValue = function(s) {
		for(var j=0; j < this.keyValuePairs.length; j++) {
			if(this.keyValuePairs[j].split("=")[0] == s)
				return this.keyValuePairs[j].split("=")[1];
		}
		return false;
	}
	this.getParameters = function() 
	{
		var a = new Array(this.getLength());
		for(var j=0; j < this.keyValuePairs.length; j++) 
		{
			a[j] = this.keyValuePairs[j].split("=")[0];
		}
		return a;
	}
	this.getLength = function() { return this.keyValuePairs.length; }	
}

function queryString(key)
{
	var page = new PageQuery(window.location.search); 
	return unescape(page.getValue(key)); 
}
// 1 visible, 0 hidden
function toggleBox(szDivID, iState) 
{
   var obj = document.layers ? document.layers[szDivID] :
   document.getElementById ?  document.getElementById(szDivID).style :
   document.all[szDivID].style;
   obj.visibility = document.layers ? (iState ? "show" : "hide") :
   (iState ? "visible" : "hidden");
}

function ShowingData(DataToShow,DataToHide)
{
	showLayer(DataToShow);
	hideLayer(DataToHide);
}
function showLayer(layerName)
{
	 // Netscape 6 and IE 5+
	if (document.getElementById)
    {
		var targetElement = document.getElementById(layerName);
		document.getElementById(layerName).style.display='block';
//                targetElement.style.visibility = 'visible';
//				hideLayer('dynamic1');
    }
}


function hideLayer(layerName)
{
    if (document.getElementById) 
    {
        var targetElement = document.getElementById(layerName);
		document.getElementById(layerName).style.display='none';
//      targetElement.style.visibility = 'hidden';
//		showLayer('dynamic1');
    }
}
ns4 = (document.layers)? true:false
ie4 = (document.all)? true:false
function init()
{
	if((catloadChecker == "Process") && (advertisementChecker == "Process") && (bannerChecker == "Process"))
	{
		//document.getElementById("Layer1").style.visibility = "hidden";
	}
	if(ns4||ie4)
	{
		if (ns4) block = document.dynamic
		if (ie4) block = dynamic.style
		block.x = parseInt(block.left);
	}
	CatLoadCaller();
	//ResizeViewWithResolution();
	defaultPageBanner()
	LoadAdvertisements();
	//myMainCategoryMoving();
	//document.getElementById("DIV_LIST").style.visibility = "hidden";
	var qsVariableName, qsVariableValue;
	var query = location.href;
	query = query.substring(query.indexOf('?')+1,query.length);
	qsVariableName = query.substring(0,query.indexOf('='))
	qsVariableValue = query.substring(query.indexOf('=')+1,query.length);
	if((qsVariableName.toLowerCase()) == "didro")
	{

		document.getElementById("leftbartable").style.display = 'none';
		SetSource('/shopping/checkout.aspx'+ '?OrderID=' + qsVariableValue);
	}
}
function checkMainInterFace()
{
	//document.getElementById("DIV_LIST").style.visibility = 'hidden';
	if((catloadChecker == "Done") && (advertisementChecker == "Done") && (bannerChecker == "Done"))
	{
		if(catComView == "topper")
		{
			//H_MenuControlHeading(horizontalDefaultCat);
			hrMenu_HideAllLayers('level1');
			//hrMenu_RootLevel(horizontalDefaultCat,'stackText');
			hrMenu_RootLevel(horizontalDefaultCat,'hrMenuContainer');
			document.getElementById("DIV_LIST").style.visibility = 'hidden';
		}
		else
		{
			document.getElementById("DIV_LIST").style.display = 'block';
			document.getElementById("DIV_LIST").style.visibility = 'visible';
		}
		//document.getElementById("Layer1").style.visibility = "visible";
		//document.getElementById("loadingLayer").style.display = "none";
		if(document.getElementById("ProductSearch1_searchtxt").style.visibilty == "visible")
		{
			document.getElementById("ProductSearch1_searchtxt").focus();
		}
	}
}
function downslide() 
{
//	topLayerHide();
//	document.getElementById("DIV_LIST").style.display = 'none';
//	if(ns4||ie4)
//	{
//		if (block.x < 205)
//		{
//			block.x +=10
//			block.left = block.x
//			setTimeout("downslide()",6)
//		}
//		else
//		{
//			comb('textbarcol','textbarcol2')
//		}
//	}
}
function downslidetwo()
{
//	//document.getElementById("textbarcol2").style.display = 'block';		// New Updation for product
//	document.getElementById("DIV_LIST").style.display = 'block';			// New Updation for product
//	if(sldbox == 1)
//	{
//		myaccountopen();
//		if(ns4||ie4)
//		{
//			if (block.x >1) 
//			{
//				document.getElementById('textbarcol2').style.display='none';
//				block.x -= 10
//				block.left = block.x
//				setTimeout("downslidetwo()",6)
//			}
//			else
//			{
//				//comb('textbarcol2','textbarcol')
//			}
//		}
//	}
//	else if(sldbox == 2)
//	{
//		topLayerShow();
//		if(ns4||ie4)
//		{
//			if (block.x >1) 
//			{
//				document.getElementById('textbarcol2').style.display='none';
//				block.x -= 10
//				block.left = block.x
//				setTimeout("downslidetwo()",6)
//			}
//			else
//			{
//				//comb('textbarcol2','textbarcol')
//			}
//		}
//	}
}
function slidebox(layerName)
{
    if (GerUserAgent() != "")
    { 
	    document.getElementById(layerName).style.left=0;
	    document.getElementById(layerName).style.width= getDynamicTransform('slidebox')['width'];
	    document.getElementById(layerName).style.height = getDynamicTransform('slidebox')['height'];
	    document.getElementById(layerName).style.overflow = 'hidden';
    }
}
function textbar(layerName)
{
	if (document.getElementById(layerName))
	{
		document.getElementById(layerName).style.display='block';
	}
}

function imgone(layerhide)
{
	document.getElementById(layerhide).style.display='none';
}
function imgtwo(layershow)
{
	document.getElementById(layershow).style.display='block';
	//favlink();
}
function comb(layerhide,layershow)
{
	imgone(layerhide);
	imgtwo(layershow);
	document.getElementById("textbarcol2").style.display = 'none';		// New Updation for product
	document.getElementById("DIV_LIST").style.display = 'none';			// New Updation for product
}
//DONE BY ASHER SYED ON 2007-02-06 FOR PRODUCT PDF FILE
function GetProductPDFFile()
{
	var Data = "?product_id=" + CurrentProductID; 
	var URL = "AJAX/ProductPDFFile.aspx";
	
	window.open(URL+Data,"Product PDF File", "height=425,width=585,toolbar=no, menubar=no, location=no,status=0");
	
}

var advertisementVisiblity;   // Advertisement 
advertisementVisiblity = 0;
function LoadAdvertisements()
{
	spaceRowVis();
	//var xmlRequest = DoCallback("AJAX/Advertisements.aspx", "");
	GetBrowserIndependentElement("DIV_BOTTOM").innerHTML = loadPagesImage;
	//sendRequest("AJAX/Advertisements.aspx","","DIV_BOTTOM");
	var req=null;
	req=initXMLHTTPRequest();
	if (req)
	{
		req.open("POST","../AJAX/Advertisements.aspx",true);
		req.onreadystatechange=function()
		{
			var ready=req.readyState;
			var data=null;
			if (ready==4)
			{
				document.getElementById("DIV_BOTTOM").innerHTML=req.responseText;
				advertisementChecker = "Done";
				checkMainInterFace();
				myMainCategoryMoving();
			}
			else
			{
				document.getElementById("DIV_BOTTOM").innerHTML=loadPagesImage;
			}
				//document.getElementById("DIV_LIST").innerHTML = req.responseText
			//ReadyState;
		}
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		req.send("");
	}	
		
	//GetBrowserIndependentElement("DIV_BOTTOM").innerHTML = xmlRequest.responseText;
	//myMainCategoryMoving();
	/*if(xmlRequest.responseText == "")
	{
		advertisementVisiblity = 1;
		myMainCategoryMovingWithoutAdd();
	}
	else
	{
		advertisementVisiblity = 2;
		myMainCategoryMoving();	
	}*/
}

function LoadAdvertisementsAtInfiniOffice()
{
	//spaceRowVis();
	//var xmlRequest = DoCallback("../AJAX/Advertisements.aspx", "");
	//GetBrowserIndependentElement("DIV_BOTTOM").innerHTML = xmlRequest.responseText;
	var req=null;
	req=initXMLHTTPRequest();
	if (req)
	{
		req.open("POST","../AJAX/Advertisements.aspx",true);
		req.onreadystatechange=function()
		{
			var ready=req.readyState;
			var data=null;
			if (ready==4)
			{
				xmlResult = req.responseText;
				GetBrowserIndependentElement("DIV_BOTTOM").innerHTML = xmlResult;
				//homePagebanner_Process2 = "Done";
				//myinit();
			}
			else
			{
				GetBrowserIndependentElement("DIV_BOTTOM").innerHTML = "Please wait while the page loads.";	
			}
		}
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		req.send("");
		stop();
	}
}

function RenderImageCount()
{
	currentImageNo = 0;
	var currentImageQuantity = "/1";
	var ImageCounter = document.getElementById("image_counter");
	
	if (ImageCounter != null)
	{ 
		ImageCounter.value = currentImageQuantity;
		document.getElementById("txtCurrentImage").value = "1";
	} 
	
	ActiveCommands = document.getElementById("ACTIVECOMMANDS");
	
	if (ActiveCommands != null)
	{
		//document.getElementById("CurrentActiveCommands").innerHTML = ActiveCommands.innerHTML;
	}
	
	//var ProductImageURL = "AJAX/ProductImageSlideShow.aspx?ConvinceMeSummary=true&amp;product_id=" + CurrentProductID;
	
	
	var PrevImage = document.getElementById("prev_arrow");
	if (PrevImage != null)
	{
		if (CurrentSlideShow == 1)
		{
			PrevImage.onclick = ImageGalleryPrev;
		}
		if (CurrentSlideShow == 0)
		{
			//PrevImage.onclick = GalleryImagePrev;
			PrevImage.onclick = ImageGalleryPrev;
		}
	}
	
	var NextArrow = document.getElementById("next_arrow");

	if (NextArrow != null){
		if (CurrentSlideShow == 1){
			NextArrow.onclick = ImageGalleryNext;
		
		}
		if (CurrentSlideShow == 0){
			//NextArrow.onclick = GalleryImageNext;
			NextArrow.onclick = ImageGalleryNext;
		}		
	}
}

function GetBrowserIndependentElement(element)
{
	if (document.getElementById)
	{
	    return document.getElementById(element);
	}
	else if (document.getElementByName)
	{
	    return document.getElementByName(element);
	}
	else if (document.layers)
	{
	    return document.layers[element];
	}
	else if (document.all)
	{
	    return document.all[element];
	}
}

function ProcessConvinceMeClick()
{
	SetCurrentSummarySlideShow(); 
	LoadPCMS(); 
	ConvinceMeSummary_AttachHandler();
}

function SetCurrentSummarySlideShow()
{
	if (CurrentSlideShow == 0){CurrentSlideShow = 1;}
	else{CurrentSlideShow = 0;}
}

function LoadPCMS()
// FOR LOADING PRODUCT MEDIA FILES
{

	if (timer != null)
	{
		clearTimeout(timer);
	}

	if (CurrentProductID != 0)
	{
		var _document = null;
		try
		{
			_document = window.frames["frame_ProductFiles"].window.document;	
			if (_document != null)
			{
				window.frames["frame_ProductFiles"].MediaFiles = null;
				window.frames["frame_ProductFiles"].AudioFiles = null;
			}
		}
		catch(err)
		{
			
		}
	}

	if (CurrentSlideShow == 0)
	{
		
		var src1 = "http://" + window.location.host + "/AJAX/ProductImageFiles.aspx?product_id=" + CurrentProductID;
		window.frames["frame_ProductFiles"].location = src1;
		
		var src2 = "http://" + window.location.host + "/AJAX/MediaSlideShow.aspx?product_id=" + CurrentProductID;
		SetSourceWithCommands(src2);
				
		LoadSlideShowCommands();
		CycleFile();
		
	}
	else
	{
		var src = "http://" + window.location.host + "/AJAX/ProductMediaFiles.aspx?product_id=" + CurrentProductID;
		window.frames["frame_ProductFiles"].location = src;
		LoadSlideShowCommands();
		CycleFile();
	}
}

function ConvinceMeSummary_AttachHandler()
{
	var ConvinceMe = GetBrowserIndependentElement("img_convinceme");
	if (CurrentSlideShow == 1)
	{
		ConvinceMe.src = product_image;
		ConvinceMe.onmousedown = function () {roll_over('conve','../images/cat_img/new/product_hover.gif');}
		ConvinceMe.onmouseup = function () {roll_over('conve','../images/cat_img/new/product.gif');}
		ConvinceMe.onmouseout = function () {roll_over('conve','../images/cat_img/new/product.gif');}
		ConvinceMe.onclick = ProcessConvinceMeClick;
	}
	
	else if (CurrentSlideShow == 0)
	
	{
		ConvinceMe.src = simple_image;
		ConvinceMe.onmousedown = function () {roll_over('conve','../images/cat_img/new/convince_hover.gif');}
		ConvinceMe.onmouseup = function () {roll_over('conve','../images/cat_img/new/convince_simple.gif');}
		ConvinceMe.onmouseout = function () {roll_over('conve','../images/cat_img/new/convince_simple.gif');}
		ConvinceMe.onclick = ProcessConvinceMeClick;
	}
}

function ImageGalleryNext () 
{

	RefreshSoundButton();
	
	var MediaFiles = window.frames["frame_ProductFiles"].MediaFiles;
	var AudioFiles = window.frames["frame_ProductFiles"].AudioFiles;
	
	var FileCount;
	
	var imgFile;
	var audFile;
	
	if (MediaFiles != null)
	{
		FileCount = window.frames["frame_ProductFiles"].MediaFiles.length;
	}

	if( FileCount > 1 && currentImageNo <= FileCount)
	{
		currentImageNo++;
		if (currentImageNo < FileCount)
		{
			imgFile = window.frames["frame_ProductFiles"].MediaFiles[currentImageNo];
			SetSourceWithCommands(imgFile);
			SetMediaPlayerSoundStatus();
			//document.getElementById("image_counter").innerHTML = (currentImageNo + 1) + '/' + FileCount;
			document.getElementById("image_counter").value = '/' + FileCount;
			document.getElementById("txtCurrentImage").value = (currentImageNo + 1);
			parent.window.frames['frame_slider'].moveSlider(currentImageNo + 1);
			
			if (window.frames["frame_ProductFiles"].AudioFiles != null)
			{
				audFile = window.frames["frame_ProductFiles"].AudioFiles[currentImageNo];
				if (audFile != null)
				{
					LoadAudioPlayer(audFile);
				}
			}

		}
		else { currentImageNo--;}
	}
}

function ImageGalleryPrev() 
{

	RefreshSoundButton();
	
	var MediaFiles = window.frames["frame_ProductFiles"].MediaFiles;
	var AudioFiles = window.frames["frame_ProductFiles"].AudioFiles;
	
	var FileCount
	var imgFile;
	var audFile;
	
	if (MediaFiles != null)
	{
		FileCount = window.frames["frame_ProductFiles"].MediaFiles.length;
	}
	
	if(FileCount > 1)
	{
		if(currentImageNo > -1 && currentImageNo <= FileCount)
		{
			currentImageNo--;
			if (currentImageNo > -1)
			{
				imgFile = window.frames["frame_ProductFiles"].MediaFiles[currentImageNo];
				SetSourceWithCommands(imgFile);
				SetMediaPlayerSoundStatus();
				//document.getElementById("image_counter").innerHTML = (currentImageNo + 1) + '/' + FileCount;
				document.getElementById("image_counter").value = '/' + FileCount;
				document.getElementById("txtCurrentImage").value = (currentImageNo + 1);
				parent.window.frames['frame_slider'].moveSlider(currentImageNo + 1);
				
				if (window.frames["frame_ProductFiles"].AudioFiles != null)
				{
					audFile = window.frames["frame_ProductFiles"].AudioFiles[currentImageNo];
					if (audFile != null)
					{
						LoadAudioPlayer(audFile);
					}
				}
		
			}
			else { currentImageNo++;}
		}
	}
}

function RenderFileCount()
{
	var TotalFiles = window.frames["frame_ProductFiles"].MediaFiles.length;
	var ImageCounter = document.getElementById("image_counter");
		
	if (ImageCounter != null)
	{ 
		ImageCounter.value = '/' + TotalFiles;
		document.getElementById("txtCurrentImage").value = "1";
	} 
}

function GetImageSource()
{
	var images = window.frames["frame_details"].images;
	var currentImage = window.frames["frame_details"].currentImageNo;
	return images[currentImage];
}

function GalleryImageNext () 
{
	var Files = window.frames["frame_details"].images;
	var FileCount;
	var imgFile;
	if (Files != null)
	{
		FileCount = window.frames["frame_details"].images.length;
	}
	if( FileCount == 1)
	{
		imgFile = window.frames["frame_details"].images[0];
		SetSourceWithCommands(imgFile);
		//document.getElementById("image_counter").innerHTML = (currentImageNo + 1) + '/' + FileCount;
		document.getElementById("image_counter").value = '/' + FileCount;
		document.getElementById("txtCurrentImage").value = (currentImageNo + 1);
		
	}
	if( FileCount > 0 && currentImageNo <= FileCount)
	{
		currentImageNo++;
		if (currentImageNo < FileCount)
		{
			imgFile = window.frames["frame_details"].images[currentImageNo];
			SetSourceWithCommands(imgFile);
			//document.getElementById("image_counter").innerHTML = (currentImageNo + 1) + '/' + FileCount;
			document.getElementById("image_counter").value = '/' + FileCount;
			document.getElementById("txtCurrentImage").value = (currentImageNo + 1);
		}
		else { currentImageNo--;}
	}
}

function GalleryImagePrev() 
{
	var Files = window.frames["frame_details"].images;
	var FileCount
	var imgFile;
	if (Files != null)
	{
		FileCount = window.frames["frame_details"].images.length;
	}
	if( FileCount == 1)
	{
		imgFile = window.frames["frame_details"].images[0];
		SetSourceWithCommands(imgFile);
		//document.getElementById("image_counter").innerHTML = (currentImageNo + 1) + '/' + FileCount;
		document.getElementById("image_counter").value = '/' + FileCount;
		document.getElementById("txtCurrentImage").value = (currentImageNo + 1);
		
	}
	if(FileCount > 0)
	{
		if(currentImageNo > -1 && currentImageNo <= FileCount)
		{
			currentImageNo--;
			if (currentImageNo > -1)
			{
				imgFile = window.frames["frame_details"].images[currentImageNo];
				SetSourceWithCommands(imgFile);
				//document.getElementById("image_counter").innerHTML = (currentImageNo + 1) + '/' + FileCount;
				document.getElementById("image_counter").value = '/' + FileCount;
				document.getElementById("txtCurrentImage").value = (currentImageNo + 1);
			}
			else { currentImageNo++;}
		}
	}
}

function CallWebService(url, params)
{
	var xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
	xmlRequest.open("POST", url, false);
	xmlRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	xmlRequest.send(params);
	return xmlRequest;
}

function RemoteCallWebService(url, ns, method, params)
{
	var xmlRequest;
	xmlRequest = globalAjaxHttpObject();
	xmlRequest.open("POST", url, false);
	xmlRequest.setRequestHeader("Man", "POST " + url + "HTTP/1.1")
	xmlRequest.setRequestHeader("MessageType", "CALL")
	xmlRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
	xmlRequest.setRequestHeader("SOAPAction", ns + "/" + method);
	var sr = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +
	"<soap:Envelope " +
	"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
	"xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" " +
	"xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">" +
	"<soap:Body>" +
	"<" + method + " xmlns=\"" + ns + "\">" + params + "</" + method + "></soap:Body></soap:Envelope>";
	xmlRequest.send(sr);
	return xmlRequest;
}
/**
function Play()
{
	var play_arrow = document.getElementById("play_arrow");
	var Player = document.getElementById('frame_details').document.getElementById('MediaPlayer');
	//var Player = window.frames['frame_details'].document.getElementsByTagName('OBJECT')[0];
	if (Player == null)
	{
		stop();
		CycleFile();
		return;
	}
	
	if (Player.id == "MediaPlayer")
	{
	
		if (Player.object.playState == 3)
		{
			PausePlayer();
			play_arrow.src = "../images/play.jpg";
		}

		else if (Player.object.playState == 1)
		{
			StartPlayer();
			play_arrow.src = "../images/pause.jpg";
		}

		else if (Player.object.playState == 2)
		{
			StartPlayer();
			play_arrow.src = "../images/pause.jpg";
		}

	}
	if (Player.id == "FlashPlayer")
	{
		if (!Player.object.Playing)
		{
			StartPlayer();
			play_arrow.src = "../images/pause.jpg";
		}
		else
		{
			PausePlayer();
			play_arrow.src = "../images/play.jpg";
		}
	}
	if (Player.id == "QuickTimePlayer")
	{
		Player.Play();
	}
	CycleFile();
}

function StartPlayer()
{
	var Player = window.frames['frame_details'].document.getElementsByTagName['OBJECT'][0];
	if (Player == null){return;}
	if (Player.id == "MediaPlayer")
	{
		Player.controls.play();
	}
	if (Player.id == "FlashPlayer")
	{
		Player.Play();
	}
	if (Player.id == "QuickTimePlayer")
	{
		Player.Play();
	}
}

function PausePlayer()
{
	var Player = window.frames['frame_details'].document.getElementsByTagName['OBJECT'][0];
	if (Player == null){return;}
	if (Player.id == "MediaPlayer")
	{
		Player.controls.pause();
	}
	if (Player.id == "FlashPlayer")
	{
	  	Player.StopPlay();
	}
	if (Player.id == "QuickTimePlayer")
	{
		Player.Pause();
	}
}
function StopPlayer()
{
	var play_arrow = null;
	var Player = null;
	if (timer != null){clearTimeout(timer);}

	try
	{
		play_arrow = document.getElementById("play_arrow");
		Player = document.getElementById('frame_details').document.getElementsByTagName['OBJECT'][0];
		//var Player = window.frames['frame_details'].document.getElementsByTagName('OBJECT')[0];
	}
	catch(e){}
	


	if (Player == null)	{return;}
	
	if (Player.id == "MediaPlayer")
	{
		Player.controls.stop();
		play_arrow.src = "../images/play.jpg";
	}
	if (Player.id == "FlashPlayer")

	{
		Player.StopPlay();
		Player.Rewind();
		play_arrow.src = "../images/play.jpg";
	}
	if (Player.id == "QuickTimePlayer")
	{
		Player.Pause();
		play_arrow.src = "../images/play.jpg";
	}
}
**/
function LoadSupport(url)
{
	//FrameSize('');
	//window.frames["frame_support"].location = "http://crm.infinioffice.com/infinibot/";
	var e = window.event 
	if (url == null)
	{
		enlarge(showimage, e, "overActive", 114, 388);
		SetObjectSize("frame_support", 536, 120);
		
		//window.frames["frame_support"].location = "http://live.business4less.com";
		//NavigateToProductFromSupport(2);
		
		// BY TALHA AHMED DATED 04.04.2007
		// MODIFICATIONS FOR LOADING SUPPORT FOR ONLY FIRST CLICK ON THE SUPPORT CHAT IMAGE FRAME
		// isSupportFrameIntialiazed THIS VARIABLE IS DEFINED AT DEFAULT PAGE
		if (isSupportFrameIntialiazed == false)
		{
			
			SetSupportFrameSource();
			isSupportFrameIntialiazed = true;
		}
	}
	else
	{
		window.open(url,'mywindow');
	}
	
	//window.frames["frame_support"].location = "http://www.infinibot.com/index.php?greeting=helloinfinishops";
}


function NavigateToProductFromSupport(productID)
{
	var PageName = GetPageName();
	if (PageName.toLowerCase() == '/ajax/home.aspx')
	{
		var URL = "http://" + window.location.host + "/default.aspx?ProURL_ID="+productID;
		parent.window.location.href = URL;
	}
	else
	{
		document.getElementById("stackText").innerHTML= "";
		hideWorkFlow();
		totalPriceRemoverNew();
		var url = "http://" + location.hostname + "/Utility.asmx";
		var xmlRequest = RemoteCallWebService(url, "business4less.com", "ValidProduct", "<ProductID>" + productID.toString() + "</ProductID>");
		var xContent = ParseXMLResponse(xmlRequest)
		var result = xContent;
		if (result == "1")
		{
		    downslide();
			RelatedProduct(productID);
			ShowHideProductCommands('Product', productID, '?product_id=' + productID, productID, 'nosearch');
			
		}
	}
}

function LoadProductImageFiles(src, ProductID)
{
	// iPhone Change
	getIPhoneIViewFor("LoadProductImageFiles");
	// end iPhone Change
	relatedProductLength = new Array(0);
	if (USE_DATABASE_PRODUCTCOMMANDS)
	{
		SetSource(src);
		//SetSource("AJAX/WizardProductImage.aspx?product_id=" + ProductID);
		var srcFiles = "AJAX/ProductImageFiles.aspx?product_id=" + ProductID;
		window.frames["frame_ProductFiles"].location = srcFiles;
		SetSourceWithCommands(src);
	}
	if (USE_FILESYSTEM_PROUDCTCOMMANDS)
	{
	
	}
}


/***********************************************")
* Image Thumbnail viewer- © Dynamic Drive (www.dynamicdrive.com)")
* Last updated Sept 26th, 03'. This notice must stay intact for use")
* Visit http://www.dynamicdrive.com/ for full source code")
***********************************************/

var ie = document.all;
var ns6 = document.getElementById && !document.all;

function ietruebody() 
{ 
return (document.compatMode  &&  document.compatMode != 'BackCompat' &&  !window.opera) ? document.documentElement : document.body;
} 
function enlarge(which, e, position, imgwidth, imgheight) 
{ 
    if (ie||ns6) 
    { 
        crossobj = document.getElementById ? document.getElementById('showimage') : document.all.showimage;
		if (position == 'overActive') 
        { 
        
			pgyoffset = ns6 ? parseInt(pageYOffset) : parseInt(ietruebody().scrollTop);
            horzpos = ns6 ? pageXOffset + window.innerWidth : ietruebody().scrollLeft + ietruebody().clientWidth;
            vertpos = ns6 ? pgyoffset + window.innerHeight : pgyoffset + ietruebody().clientHeight / 2 - imgheight / 2;

            horzpos = 114;
            vertpos = 388;

            if (window.opera  &&  window.innerHeight) 
            //compensate for Opera toolbar 
            { 
                vertpos = pgyoffset + window.innerHeight / 2 - imgheight / 2;
                vertpos = Math.Max(pgyoffset, vertpos);
            } 
        } 
        else if (position == 'center') 
        { 
            pgyoffset = ns6 ? parseInt(pageYOffset) : parseInt(ietruebody().scrollTop);
            horzpos = ns6 ? pageXOffset + window.innerWidth / 2 - imgwidth / 2 : ietruebody().scrollLeft + ietruebody().clientWidth / 2 - imgwidth / 2;
            vertpos = ns6 ? pgyoffset + window.innerHeight / 2 - imgheight / 2 : pgyoffset + ietruebody().clientHeight / 2 - imgheight / 2;

            if (window.opera  &&  window.innerHeight) 
            //compensate for Opera toolbar 
            { 
                vertpos = pgyoffset + window.innerHeight / 2 - imgheight / 2;
                vertpos = Math.Max(pgyoffset, vertpos);
            } 
        } 
        else 
        { 
            var horzpos = ns6 ? pageXOffset + e.clientX : ietruebody().scrollLeft + event.clientX;
            var vertpos = ns6 ? pageYOffset + e.clientY : ietruebody().scrollTop + event.clientY;
        } 

        crossobj.style.left = horzpos + 'px';
        crossobj.style.top = vertpos + 'px';

        //crossobj.innerHTML = "<div align='right' id='dragbar'><span id='closetext' onclick='closepreview();'>Close</span></div><iframe id='frame_support' src='" + which + "'style='BACKGROUND-COLOR: transparent' name='frame_support' marginWidth='0' marginHeight='0' frameBorder='no' scrolling='no' width='0px' height='0px'> </iframe>'";
        crossobj.style.visibility = 'visible';
        return false ;
        
    }
    else 
    {
		return true;
    }
}

function closepreview()
{
	crossobj.style.visibility = 'hidden';
}

function drag_drop(e)
{
	if (ie && dragapproved)
	{
		crossobj.style.left = tempx + event.clientX - offsetx + 'px';
		crossobj.style.top = tempy + event.clientY - offsety + 'px';
	}
	else if (ns6 && dragapproved)
	{
		crossobj.style.left = tempx + e.clientX - offsetx + 'px';
		crossobj.style.top = tempy + e.clientY - offsety + 'px';
	}
	//return false
}

function initializedrag(e)
{

	if ( (ie && event.srcElement.id == 'dragbar') || (ns6 && e.target.id == 'dragbar') )
	{
		offsetx  =  ie ? event.clientX : e.clientX;
		offsety  =  ie ? event.clientY : e.clientY;

		tempx = parseInt(crossobj.style.left);
		tempy = parseInt(crossobj.style.top);


		dragapproved = true;
		document.onmousemove = drag_drop;
		
	}
}

document.onmousedown = initializedrag
document.onmouseup = new Function(dragapproved=false)
//return enlarge(url, event, 'center', 555, 128);

// Changes on chat box function visible & hide  by Usman 10/04/2007
/* function chatbox()
{
if (document.getElementById("bott").style.display = "block")
{
document.getElementById("bott").style.display = "none";
document.getElementById("btd").style.display = "none";
document.getElementById("cht").style.display = "block";
}
else
{
document.getElementById("btd").style.display = "none";
document.getElementById("cht").style.display = "block";
}
//document.getElementById(bt).style.display = "none";
//document.getElementById(ct).style.display = "block";
//document.getElementById(bo).style.display = "block";
}
*/
function chatbox()
{
	RestoreScreenWindow('../Images_Private/Main_Image/main.html');
	FrameSize('');
	document.getElementById("sup").style.visibility = "hidden";
	document.getElementById("btd").style.display = "none";
	document.getElementById("cht").style.display = "block";
	document.getElementById("BottomBannerTD").style.display = "none";
	
	/*document.getElementById("sup").style.display = "none";
	document.getElementById("btd").style.display = "none";
	document.getElementById("cht").style.display = "block";*/
}
//document.getElementById(bt).style.display = "none";
//document.getElementById(ct).style.display = "block";
//document.getElementById(bo).style.display = "block";


function chatboxhide()
{
	// incase athena is not available on the page, the following divs were making prb. so the conditions are added
	if(document.getElementById("btd"))
	{
		document.getElementById("btd").style.display = "block";
	}
	if(document.getElementById("sup"))
	{
		document.getElementById("sup").style.visibility = "visible";
	}
	if(document.getElementById("cht"))
	{
		document.getElementById("cht").style.display = "none";
    }
    if (document.getElementById("nchat")) {
        document.getElementById("nchat").src = "../images/chat.jpg";
    }
	CheckBottombannerNew();
}
/* 
function chatboxclose()
{
document.getElementById("btd").style.display = "block";
document.getElementById("bott").style.display = "none";
document.getElementById("cht").style.display = "none";
isSupportFrameIntialiazed = false;
}


function bothide()
{
document.getElementById("btd").style.display = "none";
document.getElementById("bott").style.display = "none";
document.getElementById("cht").style.display = "block";
}
*/
// Changes end on chat box function visible & hide  by Usman 10/04/2007

function setDocumentDomain()
{
	//backButtonOverride();
	if (fullDomainName == "")
	{
		fullDomainName = document.domain;
	}
	var domain = document.domain;
	document.domain = domain.substring(domain.indexOf('.')+1);
	setCookie();
}

function SetSupportFrameSource()
{
	var liveDomain = "http://live." + document.domain;
	var ifrm = document.getElementById("frame_support");
	ifrm.src  = liveDomain;
	
}


//DONE BY ASHER SYED FOR PRODUCT CONFIG WIZARD ON 5-04-2007
function showSelected(ddl)
{
	var selObj = parent.window.frames['frame_details'].document.getElementById(ddl);
	var selIndex = selObj.selectedIndex;
	return false;
}


/**
function loadChildLevels(elementID, productID, wizardID, parentLevel, childLevel, childLevelType)
{
	var selObj = parent.window.frames['frame_details'].document.getElementById(elementID);
	var selIndex = selObj.selectedIndex;
	//var dependentLevel = selObj.options[selIndex].text;
	var dependentOption = selObj.options[selIndex].value;

	//var url = "http://" + location.hostname + "/Utility.asmx/GetWizardLevelOptions";
	var url = "http://" + location.hostname + "/Utility.asmx";
	//var params = "ElementID=" + elementID.toString() + "&ProductID=" + productID.toString() + "&WizardID=" + wizardID.toString() + "&LevelID=" + childLevel.toString() + "&DependentLevel=" + parentLevel.toString() + "&DependentOption=" + dependentOption.toString();
	var params = "<ElementID>" + elementID.toString() + "</ElementID><ProductID>" + productID.toString() + "</ProductID><WizardID>" + wizardID.toString() + "</WizardID><LevelID>" + childLevel.toString() + "</LevelID><DependentLevel>" + parentLevel.toString() + "</DependentLevel><DependentOption>" + dependentOption.toString() + "</DependentOption>";
	//var xmlRequest = CallWebService(url, params);
	var xmlRequest = RemoteCallWebService(url, "business4less.com", "GetWizardLevelOptions", params);
		//var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
	//xmlDoc.loadXML(xmlRequest.responseXML.text);
	var xmlDoc = XMLDOMObject(ParseXMLResponse(xmlRequest));
		for (i = 0; i < xmlDoc.childNodes[0].childNodes.length; i++)
	{
		var xmlNode = xmlDoc.childNodes[0].childNodes[i];
		var _elementID = xmlNode.nodeName;
		var childWizardLevel = parent.window.frames['frame_details'].document.getElementById(_elementID);
		var childWizardLevelContainer = childWizardLevel.parentNode;
		//childWizardLevelContainer.innerHTML = xmlNode.childNodes[0].xml;
		childWizardLevelContainer.innerHTML = xmlNode.childNodes[0];
	}
	
	CalculateAmount_WizardProduct(wizardID);
} **/


function loadChildLevels(elementID, productID, wizardID, parentLevel, childLevel, childLevelType)
{
	// iPhone Change
	// end iPhone Change
	if( childLevel == null && childLevelType == null) 
	{
		CalculateAmount_WizardProduct(wizardID);
		return;
	} 
	var selObj = parent.window.frames['frame_details'].GetBrowserIndependentElement(elementID);
	var selIndex = selObj.selectedIndex;
	
	//var dependentLevel = selObj.options[selIndex].text;
	var dependentOption = selObj.options[selIndex].value;

	//var url = "http://" + location.hostname + "/Utility.asmx/GetWizardLevelOptions";
	var url = "http://" + location.hostname + "/Utility.asmx";
	//var params = "ElementID=" + elementID.toString() + "&ProductID=" + productID.toString() + "&WizardID=" + wizardID.toString() + "&LevelID=" + childLevel.toString() + "&DependentLevel=" + parentLevel.toString() + "&DependentOption=" + dependentOption.toString();
	var params = "<ElementID>" + elementID.toString() + "</ElementID><ProductID>" + productID.toString() + "</ProductID><WizardID>" + wizardID.toString() + "</WizardID><LevelID>" + childLevel.toString() + "</LevelID><DependentLevel>" + parentLevel.toString() + "</DependentLevel><DependentOption>" + dependentOption.toString() + "</DependentOption>";
	//var xmlRequest = CallWebService(url, params);
	var xmlRequest = RemoteCallWebService(url, "business4less.com", "GetWizardLevelOptions", params);
	
	//var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
	//xmlDoc.loadXML(xmlRequest.responseXML.text);
	
	var xmlContent = ParseXMLResponse(xmlRequest);
	var xmlDoc = GetWizardControlsAsXMLDocument(xmlContent);

	for (i = 0; i < xmlDoc.childNodes.length; i++)
	{
		var xmlNode = xmlDoc.childNodes._nodes[i];
		var _elementID = xmlNode.nodeName;
		var childWizardLevel = top.window.frames['frame_details'].GetBrowserIndependentElement(_elementID);
		var childWizardLevelContainer = childWizardLevel.parentNode;
	
		if (BrowserDetect.browser == "Explorer" && BrowserDetect.version >= 4)
		{
			var temp = xmlNode.childNodes._nodes[0].getXML();
			temp = temp.replace(/&apos;/g, "'");
			temp = temp.replace(/''/g, "null");
			temp = temp.replace(/(\")/g, "\"");
			childWizardLevelContainer.innerHTML = temp;
		}
		else
		{
			var temp = xmlNode.childNodes._nodes[0].getXML();
			temp = temp.replace(/&apos;/g, "'");
			temp = temp.replace(/''/g, "null");
			temp = temp.replace(/(\")/g, "\"");
			childWizardLevelContainer.innerHTML = temp;
		}
	}

	//getIPhoneIViewFor("loadChildLevels");
	
	CalculateAmount_WizardProduct(wizardID);

}



function loadChildLevelsForOption(elementID, productID, wizardID, parentLevel, childLevel, childLevelType)
{

	var selObj = parent.window.frames['frame_details'].GetBrowserIndependentElement(elementID);
	var selOpt;
	var OptionStatus;
	var dependentOption;
	
	//selObj.rows.length		
	//selObj.rows(0).cells(0).childNodes(0)
	//selObj.rows(1).cells(0).childNodes(0).checked
	
	for (i = 0; i < selObj.rows.length; i++)
	{
		selOpt = selObj.rows(i).cells(0).childNodes(0)
		OptionStatus = selOpt.checked;
		if (OptionStatus == true)
		{
			dependentOption = selOpt.value;
			break;
		}
	}

	if (OptionStatus == true)
	{
		//var url = "http://" + location.hostname + "/Utility.asmx/GetWizardLevelOptions";
		var url = "http://" + location.hostname + "/Utility.asmx";
		//var params = "ElementID=" + elementID.toString() + "&ProductID=" + productID.toString() + "&WizardID=" + wizardID.toString() + "&LevelID=" + childLevel.toString() + "&DependentLevel=" + parentLevel.toString() + "&DependentOption=" + dependentOption.toString();
		var params = "<ElementID>" + elementID.toString() + "</ElementID><ProductID>" + productID.toString() + "</ProductID><WizardID>" + wizardID.toString() + "</WizardID><LevelID>" + childLevel.toString() + "</LevelID><DependentLevel>" + parentLevel.toString() + "</DependentLevel><DependentOption>" + dependentOption.toString() + "</DependentOption>";
		//var xmlRequest = CallWebService(url, params);
		var xmlRequest = RemoteCallWebService(url, "business4less.com", "GetWizardLevelOptions", params);
		
		//var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		//xmlDoc.loadXML(xmlRequest.responseXML.text);
		
		var xmlContent = ParseXMLResponse(xmlRequest);
		var xmlDoc = GetWizardControlsAsXMLDocument(xmlContent);

		for (i = 0; i < xmlDoc.childNodes.length; i++)
		{
			var xmlNode = xmlDoc.childNodes._nodes[i];
			var _elementID = xmlNode.nodeName;
			var childWizardLevel = top.window.frames['frame_details'].GetBrowserIndependentElement(_elementID);
			var childWizardLevelContainer = childWizardLevel.parentNode;
			
			if (BrowserDetect.browser == "Explorer" && BrowserDetect.version >= 4)
			{
				//childWizardLevelContainer.innerHTML = xmlNode.childNodes._nodes[0].getXML();
				var temp = xmlNode.childNodes._nodes[0].getXML();
				temp = temp.replace(/&apos;/g, "'");
				temp = temp.replace(/''/g, "null");
				temp = temp.replace(/(\")/g, "\"");
				childWizardLevelContainer.innerHTML = temp;				
			}
			else
			{
				//childWizardLevelContainer.innerHTML = xmlNode.childNodes._nodes[0].getXML();
				var temp = xmlNode.childNodes._nodes[0].getXML();
				temp = temp.replace(/&apos;/g, "'");
				temp = temp.replace(/''/g, "null");
				temp = temp.replace(/(\")/g, "\"");
				childWizardLevelContainer.innerHTML = temp;
			}
		}
		
		CalculateAmount_WizardProduct(wizardID);
	}
}


function noAlphaBets(e)
{
	var keynum
	var keychar
	var numcheck

	// IE
	if(window.event) {keynum = e.keyCode}
	// Netscape/Firefox/Opera
	else if(e.which) {keynum = e.which}
	
	keychar = String.fromCharCode(keynum)
	numcheck = /\D/

	if (numcheck.test(keychar))
	{
		if (keynum == 13)
		{
			/**currentImageNo = document.getElementById("txtCurrentImage").value - 1;
			if (currentImageNo < 0)
			{
				currentImageNo = 0;	
			}
			**/
			//ImageGalleryMove();
			var val = document.getElementById("txtCurrentImage").value;
			_SlideShowCommands.MoveSliderToQueryValue(val);
		}
		else
		{
			return numcheck;
		}
	}

}

function ImageGalleryMove() 
{

	RefreshSoundButton();	
	
	var MediaFiles = window.frames["frame_ProductFiles"].MediaFiles;
	var AudioFiles = window.frames["frame_ProductFiles"].AudioFiles;
	
	var FileCount;
	
	var imgFile;
	var audFile;

	
	if (MediaFiles != null)
	{
		FileCount = window.frames["frame_ProductFiles"].MediaFiles.length;
	}

	if( FileCount == 1)
	{
		imgFile = window.frames["frame_ProductFiles"].MediaFiles[0];
		SetSourceWithCommands(imgFile);
		SetMediaPlayerSoundStatus();
		//document.getElementById("image_counter").innerHTML = (currentImageNo + 1) + '/' + FileCount;
		var TotalFiles = document.getElementById("image_counter");
		if (TotalFiles != null)
		{
			TotalFiles.value = '/' + FileCount;		
		}
				
		if (window.frames["frame_ProductFiles"].AudioFiles != null)
		{
			audFile = window.frames["frame_ProductFiles"].AudioFiles[0];
			if (audFile != null)
			{
				LoadAudioPlayer(audFile);
			}			
		}
	
	}
	
	if( FileCount > 0 && currentImageNo <= FileCount)
	{
		//currentImageNo++;
		if (currentImageNo < FileCount)
		{
			imgFile = window.frames["frame_ProductFiles"].MediaFiles[currentImageNo];
			SetSourceWithCommands(imgFile);
			
			//document.getElementById("image_counter").innerHTML = (currentImageNo + 1) + '/' + FileCount;
			
			var TotalFiles = document.getElementById("image_counter");
			if (TotalFiles != null) {
			
				TotalFiles.value = '/' + FileCount;	
				parent.window.frames['frame_slider'].moveSlider(currentImageNo + 1);
			}
			//document.getElementById("txtCurrentImage").value = (currentImageNo + 1);
			
			if (window.frames["frame_ProductFiles"].AudioFiles != null)
			{
				audFile = window.frames["frame_ProductFiles"].AudioFiles[currentImageNo];
				if (audFile != null)
				{
					LoadAudioPlayer(audFile);
				}
			}

		}
	}
}

function GetDocumentTitle()
{
	var domain = document.domain;
	var words = domain.split('.');
	var result = "::.. Welcome to " + words[1] + " ..::";
	return result;
}


function GetWizardLevels(merchantID, wizardID)
{

	var url = "http://" + location.hostname + "/Utility.asmx";
	var params = "<MerchantID>" + merchantID.toString() + "</MerchantID><WizardID>" + wizardID.toString() + "</WizardID>";
	var xmlRequest = RemoteCallWebService(url, "business4less.com", "GetWizardLevels", params);
	
	//var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
	//xmlDoc.loadXML(xmlRequest.responseXML.text);

	var xmlContent = ParseXMLResponse(xmlRequest);
	var xmlDoc = GetWizardControlsAsXMLDocument(xmlContent);
	
	var LinkCode = "";

	for (i = 0; i < xmlDoc.childNodes.length; i++)
	{
	
		var xmlNode = xmlDoc.childNodes._nodes[i];
		var _elementID = xmlNode.nodeName;
		var childWizardLevel = GetBrowserIndendentElementForDocument(parent.window.frames["frame_details"].document, WizCtrlName + _elementID);
		var childWizardLevelContainer = childWizardLevel.parentNode;
		
		switch (_elementID.substr(0,5))
		{
			case "_ddl_":
				var selIndex = childWizardLevel.selectedIndex;
				var selValue = childWizardLevel.options[selIndex].value;
				LinkCode += "." + selValue;
				
			break
			
			case "_rbl_":
			
				var selOpt;
				var OptionStatus;
				
				for (i = 0; i < childWizardLevel.rows.length; i++)
				{
					selOpt = childWizardLevel.rows[i].cells[0].childNodes[0]
					OptionStatus = selOpt.checked;
					if (OptionStatus == true)
					{
						LinkCode += "." + selOpt.value;
						break;
					}
				}
			break
		}
	}
	
	var RedirectURL;
	
	if (WORKFLOW_PRODUCT == true && WORKFLOW_PRODUCT_MANDATORY == 1)
	{
		RedirectURL = "/AJAX/ProductSelector.aspx?WizardID=" + wizardID + "&LinkCode=" + LinkCode + "&ProductID=" + CurrentProductID + "&workflow_product=1&mandatory=" + WORKFLOW_PRODUCT_MANDATORY.toString();
	}
	else if (WORKFLOW_PRODUCT == true && WORKFLOW_PRODUCT_MANDATORY == 0)
	{
		RedirectURL = "/AJAX/ProductSelector.aspx?WizardID=" + wizardID + "&LinkCode=" + LinkCode + "&ProductID=" + CurrentProductID + "&workflow_product=1&mandatory=" + WORKFLOW_PRODUCT_MANDATORY.toString();	
	}
	else
	{
		RedirectURL = "/AJAX/ProductSelector.aspx?WizardID=" + wizardID + "&LinkCode=" + LinkCode + "&ProductID=" + CurrentProductID;
	}
	
	parent.window.frames['frame_details'].location = RedirectURL;
	
}

//DONE BY ASHER SYED ON 2007-05-15
function LoadWizardCommands()
{
	var xmlRequest = DoCallback(_Domain + "/AJAX/WizardCommands.aspx", "?product_id=" + CurrentProductID);
	var a = document.getElementById("ACTIVECOMMANDS");
	if(a != null)
	{
		a.innerHTML = xmlRequest.responseText;
		a.style.visibility = 'visible';
	}
}

function myaccount() {

    getIPhoneIViewFor("myaccount");
    if (GetUAgentMainScript() != "") {
        relatedProductBarHide();
    }
    else {

        if (document.getElementById("stack_next")) {
            document.getElementById("stack_next").style.display = "none";
        }
        if (document.getElementById("stack_back")) {
            document.getElementById("stack_back").style.display = "none";
        }

        FrameSize('');
        document.getElementById("stackText").innerHTML = "";
        //	HideMenuCat();
        stop();
        relatedProductBarHide();
        // iPhone Change
        
        // end iPhone Change
        if (sldbox == 1) {
            document.getElementById("leftbartable").style.display = 'none';
        }
        else if (sldbox == 2) {
            downslide();
        }
    }
}
 
 function myaccountopen()
 {
	topLayerHide();
	//document.getElementById("leftbartable").style.display = 'block';
 }

function LoadCustomerRegistrationContinue(_url, _class, _text)
{
	var xmlRequest = DoCallback(_Domain + "/AJAX/RegistrationCommands.aspx", "");
	document.getElementById("ACTIVECOMMANDS").innerHTML = "<a href='" + _url + "' class=" + _class + ">" + _text + "</a>";
	document.getElementById("ACTIVECOMMANDS").innerHTML = xmlRequest.responseText;
	document.getElementById("ACTIVECOMMANDS").style.visibility = 'visible';
}

function CycleFile()
{
	var MediaFiles = window.frames["frame_ProductFiles"].MediaFiles;
	var FileCount;
	if (MediaFiles != null)
	{
		FileCount = window.frames["frame_ProductFiles"].MediaFiles.length;
		if (FileCount != 1)
		{
			if( FileCount > 1 && currentImageNo <= FileCount)
			{
			
				currentImageNo++;
				
				var CurrentImage = document.getElementById("txtCurrentImage");
				if (CurrentImage != null)
				{
					if (currentImageNo < FileCount)
					{
						CurrentImage.value = currentImageNo + 1;
					}
					else
					{
						currentImageNo = 0;
						CurrentImage.value = currentImageNo + 1;
					}
				}
				
				ImageGalleryMove();
				
				CycleFileDelay = 20;
				timer = setTimeout("CycleFile()", CycleFileDelay * 1000);

			}
			else
			{
				currentImageNo = 0;
				CycleFileDelay = 1;
				timer = setTimeout("CycleFile()", CycleFileDelay*1000);
			}
		}
	}
	else
	{
		currentImageNo = 0;
		CycleFileDelay = 20;
		timer = setTimeout("CycleFile()", CycleFileDelay * 1000);
	}
}

function LoadSlider()
{
	var SliderContainer = document.getElementById("frame_slider");
	if (SliderContainer != null)
	{
		var MediaFiles = window.frames["frame_ProductFiles"].MediaFiles;
		var FileCount;
		if (MediaFiles != null)
		{
			if (sliderTimer != null)
			{
				clearTimeout(sliderTimer);
				TimeToWaitForFilesToLoad = 1;
			}
			FileCount = window.frames["frame_ProductFiles"].MediaFiles.length;
			SliderContainer.src = "\AJAX/slider.aspx?max=" + FileCount;
			SliderContainer.style.display = 'block';
		}
		else
		{
			TimeToWaitForFilesToLoad++;
			if (TimeToWaitForFilesToLoad > 2)
			{
				if (sliderTimer != null)
				{
					clearTimeout(sliderTimer);
					TimeToWaitForFilesToLoad = 1;
				}
				FileCount = 1;
				SliderContainer.src = "\AJAX/slider.aspx?max=" + FileCount;
				SliderContainer.style.display = 'block';
			}
			else
			{
				sliderTimer = setTimeout("LoadSlider()", 1*1000);
			}
		}
	}
}
// Category Handling for window resize;
function myMainCategoryMoving()
{
	/*var ball = document.getElementById("catBall");
	var thisTop = (document.all)? ball.offsetTop :
	document.defaultView.getComputedStyle(ball, "").getPropertyValue("top");
	var thisLeft = (document.all)? ball.offsetLeft :
	document.defaultView.getComputedStyle(ball, "").getPropertyValue("top");
	*/
	//var ActiveCommandHTML = document.getElementById("ACTIVECOMMANDS").innerHTML;
	//document.getElementById("ACTIVECOMMANDS").innerHTML = "";
	if(catComView.toLowerCase() == "topper")
	{
		findPosY(document.getElementById("catBallNew"));
		findPosX(document.getElementById("catBallNew"));
	}
	else
	{	
		findPosY(document.getElementById("catBall"));
		findPosX(document.getElementById("catBall"));
	}
	//document.getElementById("ACTIVECOMMANDS").innerHTML = ActiveCommandHTML;
	//document.all.leftbartable.style.top = topCategory - 20;
	// iPhone Change
	// document.getElementById("RelatedProductDiv").style.top = topCategory + 10;
	// document.getElementById("RelatedProductDiv").style.left = leftCategory + 5;
	document.getElementById("RelatedProductDiv").style.top = getDynamicPositions("RelatedProductDiv",(topCategory + 10),(topCategory + 5))["y"]; 
	document.getElementById("RelatedProductDiv").style.left = getDynamicPositions("RelatedProductDiv",(topCategory + 10),(topCategory + 5))["x"];
	// end iPhone Change
	document.getElementById("FavouriteProductDiv").style.top = topCategory + 10;
	document.getElementById("FavouriteProductDiv").style.left = leftCategory + 5;
	// iPhone Change
	// document.getElementById("leftbartable").style.top = topCategory;
	document.getElementById("leftbartable").style.top = getDynamicPositions("myMainCategoryMoving","",topCategory)["y"]; 
	// end iPhone Change
	document.getElementById("leftbartable").style.left = leftCategory;
	document.getElementById("CompareProductDiv").style.top = topCategory + 10;
	document.getElementById("CompareProductDiv").style.left = leftCategory + 5;

}
// End of without advertisement
function LoadProductDocumentFiles()
{
	if (timer != null)
	{
		clearTimeout(timer);
	}

	if (CurrentProductID != 0)
	{
		var _document = null;
		try
		{
			_document = window.frames["frame_ProductFiles"].window.document;	
			if (_document != null)
			{
				window.frames["frame_ProductFiles"].MediaFiles = null;
				window.frames["frame_ProductFiles"].AudioFiles = null;
			}
		}
		catch(err)
		{
			
		}
	}

		//var convinceme = document.getElementById("img_convinceme")
		
		var src = "http://" + window.location.host + "/AJAX/ProductDocumentFiles.aspx?product_id=" + CurrentProductID;
		window.frames["frame_ProductFiles"].location = src;
		LoadSlideShowCommands();
		CycleFile();

}
function LoadChildren1(type, params, _URL)
{
	
	xType = type;
	xParams = params;
	x_Url = _URL;
	
	
	hideWorkFlow();
	myMainCategoryMoving();
	//document.getElementById("HistoryProductDiv").style.display= "none";
	document.getElementById("DIV_LIST").innerHTML = loadPagesImage;
	if( (_URL != "") && (_URL != "javascript:") )
	{
		document.getElementById("DIV_LIST").innerHTML = redirectURL;
		window.location=_URL;
	}
	else if(_URL == "javascript:")
	{
		document.getElementById("DIV_LIST").style.display = 'block';
		//document.getElementById("DIV_LIST").style.visibility = 'visible';
		document.getElementById("leftbartable").style.top = topCategory;
		document.getElementById("leftbartable").style.left = leftCategory;
		sldbox = 2;
		var xmlResult;	
//		document.getElementById("DIV_LIST").innerHTML = redirectURL;
		//document.getElementById("DIV_LIST").innerHTML = loadPagesImage;
		//if(_URL != "")
		//{
		//	window.location=_URL;
		//	document.getElementById("DIV_LIST").innerHTML = "";
		//}
		//else
		//{
			var req=null;
			req=initXMLHTTPRequest();
			if (req)
			{
			    //req.open("POST", "Catalog/NewProPageDis.aspx" + params, true);
			    req.open("GET", "Catalog/NewProPageDis.aspx" + params + uAgent, true);
				req.onreadystatechange=function()
				{
					var ready=req.readyState;
					var data=null;
					if (ready==4)
					{
						xmlResult = req.responseText;
						document.getElementById("DIV_LIST").innerHTML = "";
						document.getElementById("DIV_LIST").innerHTML=xmlResult;
						document.getElementById("leftbartable").style.visibility = "visible";
						secCatRes = xmlResult;

						
						//SetObjectSize("frame_details", 546, 235);
						SetObjectSize("DIV_LIST", 220, 314);
						
						initArrow('content');	//Calling arrow scrolling to be hidden
						//initArrow('contentTop');	//Calling top arrow scrolling to be hidden
						simpleTopVar = "showPro";
						
						var firstProduct;
						var i = params.indexOf('y')
						i = i + 2
						var d = params.indexOf('&',i);
						var curr = d - i;
						firstProduct = params.substr(i,curr);
						//fullViewWithURLs();
						var _fileURL;
						// Add by shahzeb 14th aprill 2008
						//var domainLth = addURLRef.length -1
						
						//for (var x=0;x<=domainLth;x++)
						//{
						//	if(addURLRef[x] != undefined)
						//	{
						/*
								if(resizeInfiniViewWithResolution ==  true)
								
								{
									_fileURL = "http://"+ window.location.host+'/cat_files/'+firstProduct+'/cat_img/resolution/index.htm';
									SetSourceWithCommands(_fileURL);
									currentCenterImage = _fileURL;
								}	
								else
								{
									_fileURL = "http://"+ window.location.host+'/cat_files/'+firstProduct+'/cat_img/index.htm';
									SetSource(_fileURL);
									currentCenterImage = _fileURL;
								}
								*/
						//	}
						//}
						//_fileURL = "http://"+ window.location.host+'\\cat_files\\'+firstProduct+'\\cat_img\\index.htm';
						
						//SetSource(_fileURL);
						catloadChecker = "Done";
						checkMainInterFace();
						myMainCategoryMoving();
					}
					else
					{
						//document.getElementById("DIV_LIST").innerHTML=loadPagesImage;
						//SetSource("/loadingpage.html");
					}
				}
				//req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
				req.send("");
		//	}
		}
	}
	//document.getElementById("catBall").innerHTML = "";
}
//initialize all

function nullAllVar()
{
	rowIdMainLevel2 = null;
	catImageIdLevel2 = null;
	rowIdMainLevel3 = null;
	catImageIdLevel3 = null;
	rowIdMainLevel4 = null;
	catImageIdLevel4 = null;
	rowIdMainLevel5 = null;
	catImageIdLevel5 = null;
	rowIdMainLevel6 = null;
	catImageIdLevel6 = null;
	rowIdMainLevel7 = null;
	catImageIdLevel7 = null;
	rowIdMainLevel8 = null;
	catImageIdLevel8 = null;
	
	//activeID = 0;
	//activeID_Lvl3 = 0;
	//activeID_Lvl4 = 0; 
	//activeID_Lvl5 = 0;
	//activeID_Lvl6 = 0;
	//activeID_Lvl7 = 0;
	//activeID_Lvl8 = 0;
}

// Level 2
var rowIdMainLevel2;	//	Row to be hide
var catImageIdLevel2;		// Image to be changed
rowIdMainLevel2 = null;
catImageIdLevel2 = null;
function categoryCloser2()
{
	if(rowIdMainLevel2 != null)
	{
		document.getElementById(rowIdMainLevel2).innerHTML = "";
		document.getElementById(rowIdMainLevel2).style.visibility = 'hidden';
		pluschange(catImageIdLevel2,rowIdMainLevel2);
		rowIdMainLevel2 = null;
		catImageIdLevel2 = null;
	}
}

// Level 3
var rowIdMainLevel3;	//	Row to be hide
var catImageIdLevel3;		// Image to be changed
rowIdMainLevel3 = null;
catImageIdLevel3 = null;
function categoryCloserlevel3()
{
	var lvlText;
	lvlText = "3";
	if(rowIdMainLevel3 != null)
	{
		document.getElementById(rowIdMainLevel3).innerHTML = "";
		document.getElementById(rowIdMainLevel3).style.visibility = 'hidden';
		pluschange(catImageIdLevel3,rowIdMainLevel3);
		rowIdMainLevel3 = null;
		catImageIdLevel3 = null;
		multipleChanger(lvlText);
		activeID_Lvl3 = 0;
		//exit;
	}
}
// Level 4
var rowIdMainLevel4;	//	Row to be hide
var catImageIdLevel4;		// Image to be changed
rowIdMainLevel4 = null;
catImageIdLevel4 = null;
function categoryCloserlevel4()
{
	var lvlText;
	lvlText = "4";
	multipleChanger(lvlText);
	if(rowIdMainLevel4 != null)
	{
		document.getElementById(rowIdMainLevel4).innerHTML = "";
		document.getElementById(rowIdMainLevel4).style.visibility = 'hidden';
		pluschange(catImageIdLevel4,rowIdMainLevel4);
		rowIdMainLevel4 = null;
		catImageIdLevel4 = null;
		multipleChanger(lvlText);
		activeID_Lvl4 = 0;
		//exit;
	}
}
// Level 5
var rowIdMainLevel5;	//	Row to be hide
var catImageIdLevel5;		// Image to be changed
rowIdMainLevel5 = null;
catImageIdLevel5 = null;
function categoryCloserlevel5()
{
	var lvlText;
	lvlText = "5";
	if(rowIdMainLevel5 != null) {
	    //Modified by Talha
		document.getElementById(rowIdMainLevel5).innerHTML = "";
		document.getElementById(rowIdMainLevel5).style.visibility = 'hidden';
		pluschange(catImageIdLevel5,rowIdMainLevel5);
		rowIdMainLevel5 = null;
		catImageIdLevel5 = null;
		multipleChanger(lvlText);
		activeID_Lvl5 = 0;
		rowIdMainLevel6 = null;
		catImageIdLevel6 = null;
		//exit;
	}
}
// Level 6 
var rowIdMainLevel6;	//	Row to be hide
var catImageIdLevel6;		// Image to be changed
rowIdMainLevel6 = null;
catImageIdLevel6 = null;
function categoryCloserlevel6()
{
	var lvlText;
	lvlText = "6";
	if(rowIdMainLevel6 != null) {

	    //Modified by Talha
		document.getElementById(rowIdMainLevel6).innerHTML = "";
		document.getElementById(rowIdMainLevel6).style.visibility = 'hidden';
		pluschange(catImageIdLevel6,rowIdMainLevel6);
		rowIdMainLevel6 = null;
		catImageIdLevel6 = null;
		multipleChanger(lvlText);
		activeID_Lvl6 = 0;
		rowIdMainLevel7 = null;
		catImageIdLevel7 = null;
		//exit;
	}
}
// Level 7 
var rowIdMainLevel7;	//	Row to be hide
var catImageIdLevel7;		// Image to be changed
rowIdMainLevel7 = null;
catImageIdLevel7 = null;
function categoryCloserlevel7()
{
	var lvlText;
	lvlText = "7";
	if(rowIdMainLevel7 != null)
	{
		document.getElementById(rowIdMainLevel7).innerHTML = "";
		document.getElementById(rowIdMainLevel7).style.visibility = 'hidden';
		pluschange(catImageIdLevel7,rowIdMainLevel7);
		rowIdMainLevel7 = null;
		catImageIdLevel7 = null;
		multipleChanger(lvlText);
		activeID_Lvl7 = 0;
		rowIdMainLevel8 = null;
		catImageIdLevel8 = null;
		//exit;
	}
}
// Level 8 
var rowIdMainLevel8;	//	Row to be hide
var catImageIdLevel8;		// Image to be changed
rowIdMainLevel8 = null;
catImageIdLevel8 = null;
function categoryCloserlevel8()
{
	var lvlText;
	lvlText = "8";
	if(rowIdMainLevel8 != null)
	{
		document.getElementById(rowIdMainLevel8).innerHTML = "";
		document.getElementById(rowIdMainLevel8).style.visibility = 'hidden';
		pluschange(catImageIdLevel8,rowIdMainLevel8);
		rowIdMainLevel8 = null;
		catImageIdLevel8 = null;
		multipleChanger(lvlText);
		activeID_Lvl8 = 0;
		//exit;
	}
}

function activeLevelzero() {
    activeID = 0;
    activeID_Lvl3 = 0;
    activeID_Lvl4 = 0;
    activeID_Lvl5 = 0;
    activeID_Lvl6 = 0;
    activeID_Lvl7 = 0;
    activeID_Lvl8 = 0;
}


var activeID,activeID_Lvl3,activeID_Lvl4,activeID_Lvl5,activeID_Lvl6,activeID_Lvl7,activeID_Lvl8;
activeID = 0;
activeID_Lvl3 = 0;
activeID_Lvl4 = 0; 
activeID_Lvl5 = 0;
activeID_Lvl6 = 0;
activeID_Lvl7 = 0;
activeID_Lvl8 = 0;
function ShowHideInnerLayout(type, params, queryString, rowID, imageid, catlevel, _URL)
{
	hideWorkFlow();
	document.getElementById("HistoryProductDiv").style.display= "none";
	document.getElementById("leftbartable").style.display= "block";
	document.getElementById("DIV_LIST").style.display= "block";
	if( (_URL != "") && (_URL != "javascript:") )
	{
		//window.location=_URL;
		document.getElementById("DIV_LIST").innerHTML = redirectURL;
		//exit;
	}
	else if (_URL == "javascript:")
	{	
		if (type == "Category")
		{
			UnLoadCommands();
			
			//if(document.getElementById(DIV_LIST.rowID).style.visibility == 'hidden')
			if(document.getElementById(rowID+"hidden").style.visibility == 'hidden')
			{
				if(activeID != rowID)
				{
					if((catlevel != activeID_Lvl3) && (catlevel != activeID_Lvl4) && (catlevel != activeID_Lvl5) && (catlevel != activeID_Lvl6) && (catlevel != activeID_Lvl7) && (catlevel != activeID_Lvl8)) 
					{
						document.getElementById(rowID+"hidden").style.visibility = 'visible';
						var xmlRes;
						//document.getElementById(rowID).innerHTML = "<img src='/images/cat_img/new/circle-ball-dark-antialiased.gif' />";
						document.getElementById(rowID+"hidden").innerHTML = loadPagesImage;
						/*var xmlRequest = DoCallback("Catalog/NewInnerCatPro.aspx", params);
						xmlRes = xmlRequest.Responsetext;
						document.getElementById(rowID).innerHTML = xmlRes;*/
						var req=null;
						req=initXMLHTTPRequest();
						if (req)
						{
							req.open("GET","Catalog/NewInnerCatPro.aspx"+params,true);
							req.onreadystatechange = function() {
							    var ready = req.readyState;
							    var data = null;
							    if (ready == 4) {
							        xmlResult = req.responseText;
							        document.getElementById(rowID + "hidden").innerHTML = xmlResult;
							        var firstProduct;
							        var i = params.indexOf('y')
							        i = i + 2
							        var d = params.indexOf('&', i);
							        var curr = d - i;
							        firstProduct = params.substr(i, curr);
							        var _fileURL;
							        // Add by shahzeb 14th aprill 2008
							        /**
							        var domainLth = addURLRef.length
									
									for (var x=0;x<=domainLth;x++)
							        {
							        if(addURLRef[x] != undefined)
							        {
							        if(addURLRef[x] == window.location.host)
							        {
							        _fileURL = "http://"+ window.location.host+'/cat_files/'+firstProduct+'/cat_img/resolution/index.htm';
							        SetSourceWithCommands(_fileURL);
							        currentCenterImage = _fileURL;
							        }	
							        else
							        {
							        _fileURL = "http://"+ window.location.host+'/cat_files/'+firstProduct+'/cat_img/index.htm';
							        SetSource(_fileURL);
							        currentCenterImage = _fileURL;
							        }
							        }
										
									}
							        //_fileURL = "http://"+ window.location.host+'\\cat_files\\'+firstProduct+'\\cat_img\\index.htm';
									
									//SetSource(_fileURL);
									
									if(resizeInfiniViewWithResolution == true)
							        {
							        _fileURL = "http://"+ window.location.host+'/cat_files/'+firstProduct+'/cat_img/resolution/index.htm';
							        SetSourceWithCommands(_fileURL);
							        currentCenterImage = _fileURL;
							        }	
							        else
							        {
							        _fileURL = "http://"+ window.location.host+'/cat_files/'+firstProduct+'/cat_img/index.htm';
							        SetSource(_fileURL);
							        currentCenterImage = _fileURL;
							        }
									
                                    */
							        activeID = rowID; // to close the row chk this
							        showRow = 1;
							        if (catlevel == 2) {
							            rowIdMainLevel2 = rowID + "hidden";
							            catImageIdLevel2 = imageid;
							            pluschange(catImageIdLevel2, rowIdMainLevel2);
							        }
							        else if (catlevel == 3) {
							            activeID_Lvl3 = catlevel;
							            rowIdMainLevel3 = rowID + "hidden";
							            catImageIdLevel3 = imageid;
							            pluschange(catImageIdLevel3, rowIdMainLevel3);
							        }
							        else if (catlevel == 4) {
							            activeID_Lvl4 = catlevel;
							            rowIdMainLevel4 = rowID + "hidden";
							            catImageIdLevel4 = imageid;
							            pluschange(catImageIdLevel4, rowIdMainLevel4);
							        }
							        else if (catlevel == 5) {
							            activeID_Lvl5 = catlevel;
							            rowIdMainLevel5 = rowID + "hidden";
							            catImageIdLevel5 = imageid;
							            pluschange(catImageIdLevel5, rowIdMainLevel5);
							        }
							        else if (catlevel == 6) {
							            activeID_Lvl6 = catlevel;
							            rowIdMainLevel6 = rowID + "hidden";
							            catImageIdLevel6 = imageid;
							            pluschange(catImageIdLevel6, rowIdMainLevel6);
							        }
							        else if (catlevel == 7) {
							            activeID_Lvl7 = catlevel;
							            rowIdMainLevel7 = rowID + "hidden";
							            catImageIdLevel7 = imageid;
							            pluschange(catImageIdLevel7, rowIdMainLevel7);
							        }
							        else if (catlevel == 8) {
							            activeID_Lvl8 = catlevel;
							            rowIdMainLevel8 = rowID + "hidden";
							            catImageIdLevel8 = imageid;
							            pluschange(catImageIdLevel8, rowIdMainLevel8);
							        }
							        //activeID = 0;
							    }
							    else {
							        document.getElementById(rowID + "hidden").innerHTML = "";
							        document.getElementById(rowID + "hidden").innerHTML = loadPagesImage;
							    }
							}
							//req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
							req.send("");
						}
					}
					else
					{
						multipleChanger(catlevel);	
					}	
				}
				else
				{
					activeID = 0;
					multipleChanger(catlevel);
					
				}
			}
			
			else if(document.getElementById(rowID+"hidden").style.visibility == 'visible')
			{
				document.getElementById(rowID+"hidden").innerHTML = "";
				document.getElementById(rowID+"hidden").style.visibility = 'hidden';
				showRow = 0;
				pluschange(imageid,rowID+"hidden");
			}
			
		}
		else if (type == "Product")
		{
			ProAlert = 1;
			FavproductId = ProdId;
			CurrentProductID = params;
			LoadProductCommands(queryString);
			ProAlert = 1;
		}
	}	
}
function multipleChanger(catlevel)
{
	switch (catlevel)
	{
		case "3":
			//activeID_Lvl3 = 0
			activeID_Lvl4 = 0
			activeID_Lvl5 = 0
			activeID_Lvl6 = 0
			activeID_Lvl7 = 0
			activeID_Lvl8 = 0
		break;
		case "4":
			//activeID_Lvl4 = 0
			activeID_Lvl5 = 0
			activeID_Lvl6 = 0
			activeID_Lvl7 = 0
			activeID_Lvl8 = 0
		break;
		case "5":
			//activeID_Lvl5 = 0
			activeID_Lvl6 = 0
			activeID_Lvl7 = 0
			activeID_Lvl8 = 0
		break;
		case "6":
			//activeID_Lvl6 = 0
			activeID_Lvl7 = 0
			activeID_Lvl8 = 0
		break;
		case "7":
			//activeID_Lvl7 = 0
			activeID_Lvl8 = 0
		break;
		case "8":
			//activeID_Lvl8 = 0
		break;
		
		//default: activeID_Lvl3 = 0,activeID_Lvl4 = 0,activeID_Lvl5 = 0,activeID_Lvl6 = 0,activeID_Lvl7 = 0,activeID_Lvl8 = 0;
	}	
}

function NewtopMenu1stLevel(type, params)
{
	var xmlResult;
	//var catId = document.getElementById("renderHTML");
	//var xmlRequest = DoCallback("Catalog/NEw_top1stLevel.aspx", params, catId);
	var xmlRequest = DoCallback(_Domain + "/Catalog/NEw_top1stLevel.aspx", params);
	//document.getElementById("renderHTML").innerHTML = "";
	//document.getElementById("renderHTML").innerHTML = "<img src='/images/cat_img/new/circle-ball-dark-antialiased.gif' />";
	xmlResult = xmlRequest.responseText;
	document.getElementById("renderHTML").innerHTML = xmlResult;
	var StringToMatch = /\imagehandler.ashx\?type=\D+\&amp;item_id=\d+\&amp;width=\d+\&amp;height=\d+/;
	var firstProduct = MatchString(xmlResult, StringToMatch);
	SetSource(firstProduct);
	document.getElementById("top1stBlank").style.display = 'none';
	document.getElementById("top2ndBlank").style.display = 'none';
}

function NewtopSecond(params,notShowCat)
{
	if(notShowCat == 2)
	{
		document.getElementById("top1stBlank").style.display = 'none';
		document.getElementById("top2ndBlank").style.display = 'none';
	}
	else
	{
		document.getElementById("top1stBlank").style.display = 'block';
		document.getElementById("top2ndBlank").style.display = 'block';
	}	
	document.getElementById("topResulthere").innerHTML = loadPagesImage;
	var xmlRequest = DoCallback(_Domain + "/Catalog/TopSecondLvl.aspx", params);
	xmlRes = xmlRequest.Responsetext;
	document.getElementById("topResulthere").innerHTML = xmlRes;
}
function showMenuCatWithAds()
{
	
	
}
function showMenuWithoutAds()
{
	
}

function Sound()
{

	if (USE_DATABASE_PRODUCTCOMMANDS)
	{
		var sound_button = document.getElementById("sound_button");

		ChangeSound_MainPlayer();	
		ChangeSound_AudioPlayer();
		
		if (MuteState == true) 
		{
			sound_button.src = mute_image;
		}
		else
		{
			sound_button.src = sound_image;
		}
	}
	else
	{
		var sound_button = document.getElementById("sound_button");
		sound_button.onclick = null;
	}
}

function ChangeSound_MainPlayer()
{
	var sBrowser = navigator.userAgent;  
	if ((sBrowser.indexOf("IE") > -1) && (navigator.platform == "Win32"))
	{
		sBrowser = "IE";
	} 
	else 
	{
		sBrowser = "nonIE";
	}
	
	var Player = window.frames['frame_details'].document.getElementsByTagName('OBJECT')[0];
	if (Player == null){return;}
		
	if (Player.id == "MediaPlayer")
	{
		if (sBrowser == "IE") 
		{
			MuteState = Player.Mute;
		} 
		else 
		{
			MuteState = Player.GetMute();
		}
		if (MuteState == true) 
		{
			if (sBrowser == "IE") 
			{
				Player.Mute = false;
			} 
			else 
			{
				Player.SetMute(false);
			}
		} 
		else 
		{
			
			if (sBrowser == "IE") 
			{
				Player.Mute = true;
			} 
			else 
			{
				Player.SetMute(true);
			}
		}
	}
	
	if (Player.id == "FlashPlayer")
	{
		if (!Player.object.Playing)
		{
		}
		else
		{
		}
	}
	if (Player.id == "QuickTimePlayer")
	{
		MuteState = Player.GetMute();
		
		if (MuteState == true) 
		{
			Player.SetMute(false);
		} 
		else 
		{
			Player.SetMute(true);
		}	
	}	
}

function ChangeSound_AudioPlayer()
{
	var sBrowser = navigator.userAgent;  
	if ((sBrowser.indexOf("IE") > -1) && (navigator.platform == "Win32"))
	{
		sBrowser = "IE";
	} 
	else 
	{
		sBrowser = "nonIE";
	}
	
	var Player = document.getElementsByTagName('OBJECT')[1];
	if (Player == null){return;}
	
	if (Player.id == "AudioWindowsMediaPlayer")
	{
		if (sBrowser == "IE") 
		{
			MuteState = Player.Mute;
		} 
		else 
		{
			MuteState = Player.GetMute();
		}
		if (MuteState == true) 
		{
			if (sBrowser == "IE") 
			{
				Player.Mute = false;
			} 
			else 
			{
				Player.SetMute(false);
			}
		} 
		else 
		{
			if (sBrowser == "IE") 
			{
				Player.Mute = true;
			} 
			else 
			{
				Player.SetMute(true);
			}
		}
	}
	
	if (Player.id == "AudioFlashPlayer")
	{
		if (!Player.object.Playing)
		{
		}
		else
		{
		}
	}
	if (Player.id == "AudioQuickTimePlayer")
	{
		MuteState = Player.GetMute();
		
		if (MuteState == true) 
		{
			Player.SetMute(false);
		} 
		else 
		{
			Player.SetMute(true);
		}	
	}	
}
// OutSider Caller Checker
//var outSider;
function RedirectToCategory(outsider) 
{
	if (outsider > 0)
	location.href= "../default.aspx?CategoryID="+outsider;
}
function RedirectByDefault()
{
	var query = location.href;
	query = query.substring(query.indexOf('?')+1,query.length);
	catid = query.substring(query.indexOf('=')+1,query.length);
	if(catid > 0)
	{
		var xmlResult;
		var xmlRequest = DoCallback(_Domain + "/resultCate.aspx?catid=", catid);
		xmlResult = xmlRequest.responseText;
			
		topLayerShow(); 
		NewtopMenu1stLevel('Category',xmlResult); 
		LoadChildren1('Category',xmlResult);
		slidebox('slidebox1');
		textbar('textbarcol');
	}
	else if(catid <= 0)
	{
		return;
	}
}

function RefreshSoundButton()
{
	var sound_button = document.getElementById("sound_button");
	if (sound_button != null)
	{
		if (MuteState == true) 
		{
			sound_button.src = mute_image;
		}
		else
		{
			sound_button.src = sound_image;
		}		
	}
}
function resizeCheck()
{
/**
	if (document.getElementById('MOverMenu' && 'MOverFav').style.visibility == 'visible' )
	{
		ShowMenuCat();
	}
**/
}

var CatBgColor= new Array(5);
CatBgColor[0] = 0;
CatBgColor[1] = 0;
CatBgColor[2] = 0;
CatBgColor[3] = 0;
CatBgColor[4] = 0;
CatBgColor[5] = 0;

function rowbkgdOver(CatRow)
{
	for(var i=0; i<=CatBgColor.length; i++)
	{
		if(CatBgColor[i] == CatRow)
		{
			document.getElementById(CatRow).className = onClickCatBkgd;
			return;
		}
		else(CatBgColor[i] != CatRow)
		{
			document.getElementById(CatRow).className = onMouseOverCatbkgd;

		}
	}
}
function rowbkgdOut(CatRow)
{
	var i;
	i=0;
	for(i=0; i<=CatBgColor.length; i++)
	{
		if(CatBgColor[i] == CatRow)
		{
			document.getElementById(CatRow).className = onClickCatBkgd;
			return;
		}
		else(CatBgColor[i] != CatRow)
		{
			document.getElementById(CatRow).className = onMouseOutCatbkgd;
		}
	}	
}
function colorChanger(roid,catLevel)
{
	switch (catLevel)
	{
		case "3":
			CatBgColor[0] = roid;
			document.getElementById(roid).className = onClickCatBkgd;
		break;	
		case "4":
			CatBgColor[1] = roid;
			document.getElementById(roid).className = onClickCatBkgd;
		break;	
		case "5":
			CatBgColor[2] = roid;
			document.getElementById(roid).className = onClickCatBkgd;
		break;	
		case "6":
			CatBgColor[3] = roid;
			document.getElementById(roid).className = onClickCatBkgd;
		break;	
		case "7":
			CatBgColor[4] = roid;
			document.getElementById(roid).className = onClickCatBkgd;
		break;
		case "8":
			CatBgColor[5] = roid;
			document.getElementById(roid).className = onClickCatBkgd;
		break;
	}	
}
function rowProbkgdOver(CatRow)
{
	if (clikedMouseOver == "clicked")
	{
		clikedMouseOver = null;
	}	
	document.getElementById(CatRow).className = onMouseOverCatbkgd;
	/*if(lastRowId != null)
	{
		if(document.getElementById(lastRowId) != null)
		{	
			document.getElementById(lastRowId).className = onMouseOutCatbkgd;
		}	
	}
	if(lastRowFontId != null)
	{
		if(document.getElementById(lastRowFontId) != null)
		{
			document.getElementById(lastRowFontId).className = 'CatMouseOutFontColor';
		}
	}
	if(ProtdArr == CatRow)
	{
		//exit;
		return;
	}
	else
	{
		document.getElementById(CatRow).className = onMouseOverCatbkgd;
	}*/
}
function hyperLinkColor(hyperlink)
{
	//document.getElementById(hyperlink).className = 'CatMouseHoverFontColor';
	document.getElementById(hyperlink).className = switchStringForIPhone('CatMouseHoverFontColor','CatMouseHoverFontColor_wap');
	/*if(MouseOver_DisableEnable == "True")
	{
		lastRowFontId = hyperlink;
		if(document.getElementById(hyperlink) != null)
		{
			document.getElementById(hyperlink).className = 'CatMouseHoverFontColor';
		}
	}*/	
}
function hyperLinkColorOut(hyperlink)
{
	//document.getElementById(hyperlink).className = CatMouseOutFontColor';
	document.getElementById(hyperlink).className = switchStringForIPhone('CatMouseOutFontColor','CatMouseOutFontColor_wap');
}


function proClikedVar()
{
	clikedMouseOver = "clicked";
}
function rowProbkgdOut(CatRow)
{
	document.getElementById(CatRow).className = onMouseOutCatbkgd;
	if(clikedMouseOver == "clicked")
	{
		clikedMouseOver = null;
	}
	else
	{
		//if(PreviewControl == true)
		var ImagePreviewSetNew = 'false';
		var USettings = ReadCookie("usersettings");
		if (USettings != '')
		{
			var vars = USettings.split("&"); 
			for (var i=0;i<vars.length;i++) 
			{ 
				var pair = vars[i].split("="); 
				if (pair[0].toLowerCase() == "productimagepreview") 
					{ 
						ImagePreviewSetNew = pair[1]; 	
					}
			}
		}
		//if(PreviewControl == true)
		if(ImagePreviewSetNew.toLowerCase() == 'true')
		{
			//alert(currentCenterImage);
			//SetSourceWithCommands(currentCenterImage);
		}
		//SetSourceWithCommands(currentCenterImage);
	}
	/*lastRowId = CatRow;
	if(ProtdArr == CatRow)
	{
		//exit;
		return;
	}
	else
	{
		//document.getElementById(CatRow).style.backgroundColor = onMouseOutCatbkgd;
	}*/	
	//document.getElementById(CatRow).style.backgroundColor = onMouseOutCatbkgd;

}
function removeLastRowColor()
{
	//lastRowId = null;
	//lastRowFontId = null;
	//document.getElementById(lastRowId).className = onMouseOutCatbkgd;
	//document.getElementById(lastRowFontId).className = 'CatMouseOutFontColor';
}
function ArrayColorRemove()
{
	for(var i=0; i<CatBgColor.length; i++)
	
	{
		if((CatBgColor[i] != 0) && (document.getElementById(CatBgColor[i]) != null))
		{
			//document.getElementById(CatBgColor[i]).style.visibility = 'hidden';
			document.getElementById(CatBgColor[i]).className = onMouseOutCatbkgd;
			CatBgColor[i] = 0;
		}
		else
		{
			CatBgColor[i] = 0;
		}
	}
	if(ProtdArr != 0)
	{
		document.getElementById(ProtdArr).className = onMouseOutCatbkgd;
		ProtdArr = 0; 
	}
}
function nullMainCatVar()
{
	for(var i=0; i<CatBgColor.length; i++)
	{
		if(CatBgColor[i] != 0)
		{
			CatBgColor[i] = 0;
		}
	}
	
	activeID_Lvl2 = 0;
	activeID_Lvl3 = 0;
	activeID_Lvl4 = 0; 
	activeID_Lvl5 = 0;
	activeID_Lvl6 = 0;
	activeID_Lvl7 = 0;
	activeID_Lvl8 = 0;
}
function innerCatColor(newlevel)
{
	switch (newlevel)
	{
		case "4":
			if(CatBgColor[1] != 0)
			{
				document.getElementById(CatBgColor[1]).className = onMouseOutCatbkgd;
			}	
		break;
		case "5":
			if(CatBgColor[2] != 0)
			{
				document.getElementById(CatBgColor[2]).className = onMouseOutCatbkgd;
			}
		break;
		case "6":
			if(CatBgColor[3] != 0)
			{
				document.getElementById(CatBgColor[3]).className = onMouseOutCatbkgd;
			}
		break;
		case "7":
			if(CatBgColor[4] != 0)
			{
				document.getElementById(CatBgColor[4]).className = onMouseOutCatbkgd;
			}
		break;
		case "8":
			if(CatBgColor[5] != 0) 	
			{
				document.getElementById(CatBgColor[5]).className = onMouseOutCatbkgd;
			}
		break;
	}
}



//Modified By S.Zeeshan 
// Dated: 04/12/07

var fullPageWidth = screen.width*0.95; 

function defaultPageBanner(){
	
	myMainCategoryMoving();
	var screen_height = screen.height;
	var screen_width = screen.width;
	var IFrame = document.getElementById("frame_details");
	var MainTable = document.getElementById("Page_Table");
	if ((screen_width<=1023) || (screen_height<=767)){
		document.getElementById("Banner_left").style.display = "none";
		document.getElementById("Banner_bottom").style.display = "none";
		document.getElementById("Banner_right").style.display = "none";
		document.getElementById("Banner_right").innerHTML = "";
		document.getElementById("ag").style.verticalAlign = "middle";
		myMainCategoryMoving();
		IFrame.width="546"
		IFrame.height="314"
	}
	else if((screen_width<=1279) || (screen_height<=1023)){
	if(resizeInfiniViewWithResolution == false){
		document.getElementById("Banner_right").style.display = "block";
		document.getElementById("Banner_right").innerHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='223' height='562'><param name='wmode' value='transparent'><param name='movie' value='../Images_Private/Banner_1024.swf'><param name='quality' value='high'><param name='menu' value='false'><embed src='../Images_Private/Banner_1024.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='223' height='562' wmode='transparent'  ></embed></object>";
			IFrame.width="546";
			IFrame.height="314";
		//	document.getElementById("Banner_left").style.display = "block";
		//	document.getElementById("Banner_bottom").style.display = "block";
		//	document.getElementById("Banner_right").innerHTML = "<img src='../images/Banner_right_1280.jpg'/>";
		//	document.getElementById("Banner_right").innerHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='233' height='758'><param name='movie' value='../images/Banner_1280_right.swf'><param name='quality' value='high'><param name='menu' value='false'><embed src='../images/Banner_1280_right.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='233' height='758'></embed></object>";
			 
		}else{	
			MainTable.width= fullPageWidth; 	// Returns "972.8" on Resoluation 1024x768; 
			IFrame.width="768";
			IFrame.height="235";
			IFrame.align="left";
			
		}

		//document.getElementById("IFRAME_Table").width="550"; 
		//document.getElementById("frame_details").width="700";
		//document.getElementById("Banner_left").style.display = "none";
		//document.getElementById("Banner_bottom").style.display = "none";
		//document.getElementById("Banner_right").style.display = "block";
		//document.getElementById("Banner_right").innerHTML = "<img src='../images/Banner_1024.jpg'/>";
		//document.getElementById("Banner_right").innerHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='223' height='562'><param name='movie' value='../images/Banner_1024.swf'><param name='quality' value='high'><param name='menu' value='false'><embed src='../images/Banner_1024.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='223' height='562'></embed></object>";

		document.getElementById("ag").style.verticalAlign = "middle";
		myMainCategoryMoving();
	}
	else if ((screen_width>=1280) || (screen_height>=1024)){
		if(resizeInfiniViewWithResolution == false){
			document.getElementById("Banner_left").style.display = "block";
			document.getElementById("Banner_left").innerHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='233' height='758'><param name='wmode' value='transparent'><param name='movie' value='../Images_Private/Banner_1280_left.swf'><param name='quality' value='high'><param name='menu' value='false'><embed src='../Images_Private/Banner_1280_left.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='233' height='758' wmode='transparent'  ></embed></object>";
			document.getElementById("Banner_bottom").style.display = "block";
			document.getElementById("Banner_bottom").innerHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='784' height='162'><param name='wmode' value='transparent'><param name='movie' value='../Images_Private/Banner_1280_bottom.swf'><param name='quality' value='high'><param name='menu' value='false'><embed src='../Images_Private/Banner_1280_bottom.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='784' height='162' wmode='transparent'  ></embed></object>";
			document.getElementById("Banner_right").style.display = "block";
			document.getElementById("Banner_right").innerHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='233' height='758'><param name='wmode' value='transparent'><param name='movie' value='../Images_Private/Banner_1280_right.swf'><param name='quality' value='high'><param name='menu' value='false'><embed src='../Images_Private/Banner_1280_right.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='233' height='758' wmode='transparent'  ></embed></object>";
			IFrame.width="546";
			IFrame.height="314";  
		}else{	
			MainTable.width= fullPageWidth;			///"1200"
			MainTable.height= screen.height*0.8;		// 80% of Screen Resolution 
			IFrame.width= "960"; 
			IFrame.height= "477";
			IFrame.align="left";
		}
		myMainCategoryMoving();
		document.getElementById("ag").style.verticalAlign = "Top";
	}
	bannerChecker = "Done";
}

// End Modification (S.Zeeshan)






function defaultPageBannerhome()
{
	var screen_height = screen.height;
	var screen_width = screen.width;
	var IFrame = document.getElementById("IO_Office_Container");
	var MainTable = document.getElementById("Page_Table");
	if ((screen_width<=1023) || (screen_height<=767)){
		document.getElementById("Banner_left").style.display = "none";
		document.getElementById("Banner_bottom").style.display = "block";
		document.getElementById("Banner_right").style.display = "none";
		document.getElementById("Banner_right").innerHTML = "";
		document.getElementById("ag").style.verticalAlign = "middle";
		//IFrame.width="100%"
		//IFrame.height="220"
		
	}
	else if((screen_width<=1279) || (screen_height<=1023)){
	if(resizeInfiniViewWithResolution == false){
	
	
		document.getElementById("Banner_left").style.display = "block";
		document.getElementById("Banner_bottom").style.display = "block";
	
	
	//	document.getElementById("Banner_bottom").style.display = "block";
	//	document.getElementById("Banner_right").style.display = "block";
	
	
	
	//	document.getElementById("Banner_right").innerHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='223' height='562'><param name='wmode' value='transparent'><param name='movie' value='../Images_Private/Banner_1024.swf'><param name='wmode' value='transparent'><param name='quality' value='high'><param name='menu' value='false'><embed src='../Images_Private/Banner_1024.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='223' height='562' wmode='transparent'  ></embed></object>";
	//		IFrame.width="780";
	//		IFrame.height="370";
			// ADD BY KAMRAN 20080828
		//	PageBannerLoad_Main(1279,'Banner_right','right');
			 
		}else{	
			MainTable.width= fullPageWidth // Returns "972.8" on Resoluation 1024x768; 
		//	IFrame.width= "100%"; 
		//	IFrame.height= "360";
		//	IFrame.align="left";
			
		}

		document.getElementById("ag").style.verticalAlign = "middle";
	}
	else if ((screen_width>=1280) || (screen_height>=1024)){
		if(resizeInfiniViewWithResolution == false){
			
			document.getElementById("Banner_left").style.display = "block";
			//document.getElementById("Banner_left").innerHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='233' height='758'><param name='wmode' value='transparent'><param name='movie' value='../Images_Private/Banner_1280_left.swf'><param name='quality' value='high'><param name='menu' value='false'><embed src='../Images_Private/Banner_1280_left.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='233' height='758' wmode='transparent'  ></embed></object>";
			document.getElementById("Banner_bottom").style.display = "block";
			//document.getElementById("Banner_bottom").innerHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='784' height='162'><param name='wmode' value='transparent'><param name='movie' value='../Images_Private/Banner_1280_bottom.swf'><param name='quality' value='high'><param name='menu' value='false'><embed src='../Images_Private/Banner_1280_bottom.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='784' height='162' wmode='transparent'  ></embed></object>";
			document.getElementById("Banner_right").style.display = "block";
			//document.getElementById("Banner_right").innerHTML = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='233' height='758'><param name='wmode' value='transparent'><param name='movie' value='../Images_Private/Banner_1280_right.swf'><param name='quality' value='high'><param name='menu' value='false'><embed src='../Images_Private/Banner_1280_right.swf' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='233' height='758' wmode='transparent'  ></embed></object>";
			IFrame.width="780";
			IFrame.height= 370; 
			// ADD BY KAMRAN 20080828
		//	PageBannerLoad_Main(1280,'Banner_left','left');
		//	PageBannerLoad_Main(1280,'Banner_bottom','bottom');
		//	PageBannerLoad_Main(1280,'Banner_right','right');
		}else{	
			MainTable.width= fullPageWidth			///"1200"
			MainTable.height= screen.height*0.8		// 80% of Screen Resolution 
		//	IFrame.width= "100%"; 
		//	IFrame.height= "100%";
		//	IFrame.align="left";
		}
		document.getElementById("ag").style.verticalAlign = "Top";
	}
	homePagebanner_Process1 = "Done"
	defaultPageBannerhome_init();
	
	
}

function findPosX(obj) 
{ 
if(obj)
{
     var curleft = 0; 
     if (obj.offsetParent) 
     { 
          while (obj.offsetParent) 
          { 
               curleft += obj.offsetLeft 
               obj = obj.offsetParent; 
          } 
     } 
     else if (obj.x) 
          curleft += obj.x; 
          leftCategory = curleft;
     return curleft; 
}
} 
 
function findPosY(obj) 
{ 
	if(obj)
	{
		var curtop = 0; 
		if (obj.offsetParent) 
		{ 
			while (obj.offsetParent) 
			{ 
				curtop += obj.offsetTop 
				obj = obj.offsetParent; 
			} 
		} 
		else if (obj.y) 
			curtop += obj.y; 
			topCategory = curtop;
		return curtop; 
	}
}
 
//DONE BY ASHER SYED FOR SETTING DEFAULT SOUND STATUS
function SetMediaPlayerSoundStatus()
{

	var sBrowser = navigator.userAgent;  
	if ((sBrowser.indexOf("IE") > -1) && (navigator.platform == "Win32"))
	{
		sBrowser = "IE";
	} 
	else 
	{
		sBrowser = "nonIE";
	}
	
	var Player;
	
	if (window.frames['frame_details'] != null)
	{
		if (window.frames['frame_details'].document.getElementsByTagName('OBJECT') != null)
		{
			Player = window.frames['frame_details'].document.getElementsByTagName('OBJECT')[0];
		}
	}
	
	if (Player == null){return;}
		
	if (Player.id == "MediaPlayer")
	{
		if (MuteState == true) 
		{
			if (sBrowser == "IE") 
			{
				Player.Mute = false;
			} 
			else 
			{
				Player.SetMute(false);
			}
		} 
		else 
		{
			
			if (sBrowser == "IE") 
			{
				Player.Mute = true;
			} 
			else 
			{
				Player.SetMute(true);
			}
		}
	}
	
	if (Player.id == "FlashPlayer")
	{
		if (!Player.object.Playing)
		{
		}
		else
		{
		}
	}
	if (Player.id == "QuickTimePlayer")
	{
		if (MuteState == true) 
		{
			Player.SetMute(false);
		} 
	
		else 
		{
			Player.SetMute(true);
		}	
	}	

}

function SetAudioPlayerSoundStatus()
{

	var sBrowser = navigator.userAgent;  
	if ((sBrowser.indexOf("IE") > -1) && (navigator.platform == "Win32"))
	{
		sBrowser = "IE";
	} 
	else 
	{
		sBrowser = "nonIE";
	}
	
	var Player = document.getElementsByTagName('OBJECT')[1];
	if (Player == null){return;}
	
	if (Player.id == "AudioWindowsMediaPlayer")
	{
		if (MuteState == true) 
		{
			if (sBrowser == "IE") 
			{
				Player.Mute = false;
			} 
			else 
			{
				Player.SetMute(false);
			}
		} 
		else 
		{
			if (sBrowser == "IE") 
			{
				Player.Mute = true;
			} 
			else 
			{
	
				Player.SetMute(true);
			}
		}
	}
	
	if (Player.id == "AudioFlashPlayer")
	{
		if (!Player.object.Playing)
		{
		}
		else
		{
		}
	}
	if (Player.id == "AudioQuickTimePlayer")
	{
		if (MuteState == true) 
		{
			Player.SetMute(false);
		} 
		else 
		{
			Player.SetMute(true);
		}	
	}	
}
var ProtdArr;
ProtdArr = 0;
function catProductBkgdColor(proTdIds)
{
	if(proTdIds == ProtdArr)
	{
		return;
	}
	else
	{
		document.getElementById(proTdIds).className = onClickCatBkgd;
	}	
	if(ProtdArr == 0)
	{
		ProtdArr = proTdIds;
	}
	
	else if((ProtdArr != 0) && (document.getElementById(ProtdArr) != null))
	{		
		document.getElementById(ProtdArr).className = onMouseOutCatbkgd;
		ProtdArr = proTdIds;
	}	
}
function productStack(catId,proId)
{
	//params = catId+proId
    params = catId + proId + uAgent;
     
	mp_catid=params+"&mp_catType=2";
	document.getElementById("stackText").innerHTML = loadPagesImage;
	var xmlRequest = DoCallback(_Domain + "/Catalog/StackProduct.aspx", params);
	xmlRes = xmlRequest.responseText;
	document.getElementById("stackText").innerHTML = xmlRes;
	stackCategories_wap(document.getElementById('stackText').innerText, ">>" , 3);
	stop();
	
	//For Product Attribute
		renderProductAttibute(mp_catid);
}
var stactCatTemp_wap = "";
function stackCat(params)
{
    
	if (stackLevel == 0)
	{ 
		stackParms[0] = params;
		stackLevel=1;
	}
	else if (stackLevel == 1)
	{
		stackParms[1] = params;
		stackLevel=2;
	}
	else if (stackLevel == 2)
	{
		//alert('ho');
		stackParms[2] = params;
		stackLevel=3;
	}
	
	
	//document.getElementById("stackText").innerHTML = "<img src='/images/cat_img/new/circle-ball-dark-antialiased.gif' />";
	/*var xmlRequest = DoCallback("Catalog/StackCat.aspx", params);
	xmlRes = xmlRequest.Responsetext;
	document.getElementById("stackText").innerHTML = xmlRes;*/
	getIPhoneIViewFor("stackCat");
	var req=null;
	req=initXMLHTTPRequest();
	if (req) {

	    //req.open("POST", "Catalog/StackCat.aspx" + params, true);
	    req.open("GET", "Catalog/StackCat.aspx" + params + uAgent, true);
		req.onreadystatechange=function()
		{
			var ready=req.readyState;
			var data=null;
			if (ready==4)
			{
				xmlResult = req.responseText;
				document.getElementById("stackText").innerHTML = "";
				document.getElementById("stackText").innerHTML=xmlResult;
				stackCategories_wap(document.getElementById('stackText').innerText, ">>" , 3);
				
			}
			else
			{
				document.getElementById("stackText").innerHTML = "";
				//document.getElementById("stackText").innerHTML=loadPagesImageCenter;
								
			}
		}
	//	req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		req.send("");
		stop();
	}
}
function mainProductStack(mainProId)
{
	mp_catid="?"+mainProId+"&mp_catType=1";
	//document.getElementById("stackText").innerHTML = loadPagesImageCenter;
	var xmlRequest = DoCallback(_Domain + "/Catalog/StackProduct_Main.aspx?", mainProId);
	xmlRes = xmlRequest.responseText;
	document.getElementById("stackText").innerHTML = xmlRes;
	
	//For Product Attribute
		renderProductAttibute(mp_catid);
	/////////////////////////////////
}
/////////////		New Ajax Work
function initXMLHTTPRequest()
{
	var xRequest=null;
	if (window.XMLHttpRequest)
	{
		xRequest=new XMLHttpRequest();
	} 
	else if (window.ActiveXObject)
	{
		xRequest=new ActiveXObject("Microsoft.XMLHTTP");
	}
	return xRequest;
}

function ajaxGallery( container, name, galleryCode )
{
}
function ShowHideInnerLayoutNew(params,_URL)
{
	x2Params = params;
	x2_Url = _URL;
	
	if( (_URL != "") && (_URL != "javascript:") )
	{
		document.getElementById("DIV_LIST").innerHTML = redirectURL;
		//document.getElementById("Layer1").innerHTML = "";
		//document.getElementById("Layer1").innerHTML = redirectURL;
		//exit;		
	}
	else if(_URL == "javascript:")
	{
		document.getElementById("leftbartable").style.top = topCategory;
		document.getElementById("leftbartable").style.left = leftCategory;
		sldbox = 2;
		var xmlResult;	
		document.getElementById("DIV_LIST").innerHTML = loadPagesImage;
		/*var xmlRequest = DoCallback("Catalog/NewProPageDis.aspx", params);
		xmlResult = xmlRequest.responseText;
		document.getElementById("DIV_LIST").innerHTML = xmlResult;*/
	
		var req=null;
		req=initXMLHTTPRequest();
		if (req)
		{
		    //req.open("POST", "Catalog/New_PreInner_CatPro.aspx" + params, true);
		    req.open("GET", "Catalog/New_PreInner_CatPro.aspx" + params + uAgent, true);
			req.onreadystatechange=function()
			{
				var ready=req.readyState;
				var data=null;
				if (ready==4)
				{
					xmlResult = req.responseText;
					document.getElementById("DIV_LIST").innerHTML="";
					document.getElementById("DIV_LIST").innerHTML=xmlResult;
					//document.getElementById("catBall").innerHTML="";
					//secCatRes = xmlResult;
					//SetObjectSize("frame_details", 546, 235);
					SetObjectSize("DIV_LIST", 220, 350);
		
					initArrow('content');	//Calling arrow scrolling to be hidden
					initArrow('contentTop');	//Calling top arrow scrolling to be hidden
					simpleTopVar = "showPro";
					var firstProduct;
					var i = params.indexOf('y')
					i = i + 2
					var d = params.indexOf('&',i);
					var curr = d - i;
					firstProduct = params.substr(i,curr);
					var _fileURL;
					// Add by shahzeb 14th aprill 2008
					//var domainLth = addURLRef.length
					
					//for (var x=0;x<=domainLth;x++)
					//{
						//if(addURLRef[x] != undefined)
						//	{
					/**
					if(resizeInfiniViewWithResolution == true)
					{
					_fileURL = "http://"+ 

									window.location.host+'/cat_files/'+firstProduct+'/cat_img/resolution/index.htm';
					SetSourceWithCommands(_fileURL);
					currentCenterImage = _fileURL;
					}	
					else
					{
					_fileURL = "http://"+window.location.host+'/cat_files/'+firstProduct+'/cat_img/index.htm';
					SetSource(_fileURL);
					currentCenterImage = _fileURL;
					}
					**/
						//	}
						
					//}
					//_fileURL = "http://"+ window.location.host+'\\cat_files\\'+firstProduct+'\\cat_img\\index.htm';
					
					//SetSource(_fileURL);
					//SetSource(setTempImage);
					/*var StringToMatch = /AJAX\/ItemImage.aspx\?type=\D+\&amp;item_id=\d+\&amp;width=\d+\&amp;height=\d+/;
					var firstProduct = MatchString(xmlResult, StringToMatch);
					if (firstProduct == null)
					{
						StringToMatch = /AJAX\/ProductImageSlideShow.aspx\?product_id=\d+/;
						firstProduct = MatchString(xmlResult, StringToMatch);
					}
					
					if (firstProduct != null)
					{
						SetSource(firstProduct);
					}
					else
					{
						SetSource("/BlankPage.htm");
					}*/
					catloadChecker = "Done";
					checkMainInterFace();
					myMainCategoryMoving();
				}
				else
				{
					document.getElementById("DIV_LIST").innerHTML=loadPagesImage;
					//SetSource("/loadingpage.html");
				}
					//document.getElementById("DIV_LIST").innerHTML = req.responseText
				//ReadyState;
			}
		}	
		//req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		req.send("");
	}	
}
function ShowHideInnerLayoutPre(preCatId)
{
	document.getElementById(preCatId).style.visibility = 'hidden';
}

function InitializeSlideShow(mediaFiles, audioFiles)
{
	
	parent._ProductCommands.SlideShowCommands._MediaFiles = mediaFiles;
	parent._ProductCommands.SlideShowCommands._AudioFiles = audioFiles;
	parent._ProductCommands.SlideShowCommands.FileCounter = 0;
	parent._ProductCommands.SlideShowCommands.Load();
}
// Temporay product for global var
var tempProduct;
// End

function RelatedProduct(CurrentproId) {

    var RelatedProductDiv = GetElement("RelatedProductDiv");
    removeElement("FavouriteProductDiv", "HistoryProductDiv");
    
    currentRelatedProId = CurrentproId;
    tempProduct = CurrentproId;
    var params;
    params = "?CurrentProId=" + CurrentproId + uAgent;
    RelatedProductDiv.innerHTML = frameLoading;
    var _RelatedResult;
    var req = null;
    req = initXMLHTTPRequest();
    if (req) {
        req.open("GET", _Domain + "/AJAX/RelatedProduct.aspx" + params, true);
        req.onreadystatechange = function() {
            var ready = req.readyState;
            //var ready = 4;
            var data = null;
            if (ready == 4) {
                xmlResult = req.responseText;
                _RelatedResult = xmlResult;
                if (xmlResult == "No Data") {

                    _RelatedResult = xmlResult;
                    RelatedProductDiv.style.display = 'none';
                }
                else {

                    //RelatedProductDiv.style.display = 'block';
                    RelatedProductDiv.innerHTML = xmlResult;
                    _resWizardPro = RelatedProductDiv.innerHTML;
                    initArrow('reletedProducts');
                    var lengthArr;
                    alert("r");
                    lengthArr = document.getElementById("arrayLength").innerText;
                    lengthArr = lengthArr;
                    relatedProductLength = new Array(lengthArr);
                    for (var i = 0; i < lengthArr; i++) {
                        if (document.getElementById("RelatedCheckBox" + i) != null) {
                            if (document.getElementById("RelatedCheckBox" + i).checked == true) {
                                relatedProductLength[i] = document.getElementById("RelatedCheckBox" + i).value;
                            }
                            else {
                                relatedProductLength[i] = null;
                            }
                        }
                    }
                    RelatedProductDiv.style.display = 'block';
                }
                chkWizard4_Related(params, _RelatedResult);

            }
            else {
                RelatedProductDiv.innerHTML = frameLoading;
            }
        }
        //req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        req.send("");

    }

}
function chkWizard4_Related(params,resultRealted) {
    
	if (USE_DATABASE_PRODUCTCOMMANDS)
	{
		if (resultRealted == "No Data")
				{
			//		_RelatedResult = xmlResult;
					document.getElementById("RelatedProductDiv").style.display = 'none';
				}
		else if (resultRealted != "No Data")
				{
					document.getElementById("RelatedProductDiv").style.display = 'block';
				}

	}
	if (USE_FILESYSTEM_PROUDCTCOMMANDS)
	{
		var req=null;
		req=initXMLHTTPRequest();
		if (req)
		{
			req.open("GET","AJAX/PreActivateFileCheck.aspx"+params,true);
			req.onreadystatechange = function()
			 {
			    var ready = req.readyState;
			    var data = null;
			    if (ready == 4)
			     {
			        var RelatedProduct = GetElement("RelatedProductDiv");
			        xmlResult = req.responseText;
			        //alert(xmlResult);
			        if (xmlResult == "NoWizard," && resultRealted == "No Data")
			         {
			            //alert('1');
			            RelatedProduct.style.display = 'none';
			        }
			        else if (xmlResult == "NoWizard," && resultRealted != "No Data")
			        {
			            //alert('2');
			            RelatedProduct.style.display = 'block';
			        }
			        else if ((xmlResult == "Wizard," || xmlResult == "Wizard,VR") && resultRealted != "No Data") 
			        {
			            //alert('4');
			            _wizardGlobalChk = xmlResult;
			            _relatedresultchk = resultRealted;
			            RelatedProduct.style.display = 'block';
			        }
			        else if ((xmlResult == "Wizard," || xmlResult == "Wizard,VR") && resultRealted == "No Data") 
			        {
			            //alert('5');
			            _wizardGlobalChk = xmlResult;
			            _relatedresultchk = resultRealted;
			            RelatedProduct.style.display = 'none';
			        }

			        else if ((xmlResult != "Wizard," || xmlResult != "Wizard,VR") && (resultRealted != "No Data" || resultRealted == "No Data")) {
			            _wizardGlobalChk = xmlResult;
			            _relatedresultchk = resultRealted;
			            if (GetUserAgent() != "") {
			                RelatedProduct.style.display = 'none';
			            }
			        }
			    }
			}
			//req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			req.send("");
		}
	}
}
function relatedProductBarHide() {
    document.getElementById("RelatedProductDiv").style.display = 'none';
    document.getElementById("RelatedProductDiv").innerHTML= "";
	///HIDE ATTRIBUTE
	AttributeHide();
	
}
function parentStacking(ParentCatId) {
    stackLevel = 0;
	StackCateCache = ParentCatId;
	var req=null;
	req=initXMLHTTPRequest();
	stop();
	if (req)
	{
		//req.open("POST","Catalog/MainCategoryStack.aspx?ParentCategoryID="+ParentCatId,true);
	    req.open("GET", "Catalog/MainCategoryStack.aspx?ParentCategoryID=" + ParentCatId + uAgent, true);
	    req.onreadystatechange = function() {
	        var ready = req.readyState;
	        var data = null;
	        if (ready == 4) {
	            if (GetUserAgent() != "") {
	                StackSlider.ShowNavigation();
	            }
	            xmlResult = req.responseText;

	            GetElement("stackText").style.display = "block";
	            GetElement("stackText").innerHTML = xmlResult;

	        }
	        else {
	            //document.getElementById("stackText").innerHTML=loadPagesImageCenter;
	        }
	    }
		//req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		req.send("");
	}
}
function chkBoxCheck(chkBoxId,chkBoxChecked,RelatedproductLength)
{
	
	//framehistory = window.frames["frame_details"].location.href;
	//var params = "?CurrentProId="+currentRelatedProId+"&checkboxId="+chkBoxId+"&checkBoxChecked="+chkBoxChecked;
      var params = "?CurrentProId=" + currentRelatedProId + "&checkboxId=" + chkBoxId + "&checkBoxChecked=" + chkBoxChecked + uAgent;
	
	//document.getElementById("RelatedProductDiv").innerHTML = "";
	//document.getElementById("RelatedProductDiv").innerHTML = frameLoading;
	
	var req=null;
	req=initXMLHTTPRequest();
	if (req)
	{
		req.open("GET","AJAX/RelatedProduct_Clicked.aspx"+ params,true);
		req.onreadystatechange=function()
		{
			var ready=req.readyState;
			var data=null;
			if (ready==4)
			{
				xmlResult = req.responseText;
				document.getElementById("RelatedProductDiv").innerHTML=xmlResult;
				//LoadProductCommands(productCmdQuerry)
				var lengthArr;
				if (document.getElementById("arrayLength").innerText != undefined) {
					// For IE:  
					lengthArr = document.getElementById("arrayLength").innerText;
				}else{
					// For FF:   
					lengthArr = document.getElementById("arrayLength").textContent;
				}
				var lengthArr = parseInt(lengthArr);
				//lengthArr = lengthArr -1;
				//if(lengthArr == "click_scnerio")
				//{
					//lengthArr = "";
					//lengthArr = 0;
				//relatedProductLength = new Array(0)
				if (lengthArr > 0)
				{
					relatedProductLength = new Array(lengthArr);
					for (var i=0; i<lengthArr;i++)
					{
						if(document.getElementById("RelatedCheckBox"+i).checked == true)
						{
							relatedProductLength[i] = document.getElementById("RelatedCheckBox"+i).value;
							
						}
						else
						{
							relatedProductLength[i] = null;
							//relatedProductLength.splice(0,1);
						}
					}
					slideShowTotal();
				}
				initArrow('reletedProducts');	
				//LoadProductCommands(productCmdQuerry);
				//}
			}
			else
			{
				//document.getElementById("RelatedProductDiv").innerHTML = "";
				//document.getElementById("RelatedProductDiv").innerHTML= frameLoading;
			}
		}
		//req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		req.send("");
		stop();
	}	
}

function slideShowTotal()
{
	
	//if(_wizardGlobalChk == "Wizard")
	//{
		document.getElementById("slidetotal").innerHTML = "";
		document.getElementById("slidetotal").innerHTML = loadPagesImage;
		//document.getElementById("slidetotal").innerHTML = "/loadingpage.html";
		
		var req=null;
		req=initXMLHTTPRequest();
		if (req)
		{
			req.open("POST","AJAX/totalPriceShow.aspx",true);
			req.onreadystatechange=function()
			{
				var ready=req.readyState;
				var data=null;
				if (ready==4)
				{
					xmlResult = req.responseText;
					document.getElementById("slidetotal").innerHTML=xmlResult;
				}
				else
				{
					document.getElementById("slidetotal").innerHTML=loadPagesImageCenter;
				}
			}
			req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			req.send("");
			stop();
		}
	//}	
}

//DONE BY ASHER SYED FOR SEARCHING PRODUCTS ON ENTER KEY
function OnEnterKey(evt)
{
    
	var e;
	if( typeof( e ) == "undefined" && typeof( window.event ) != "undefined" ) { 
		e=window.event; 
		}
	else{
		e = evt;
		}
		
	if (typeof( window.event ) != "undefined" )
	{
		if(e.keyCode==13)
		{
		    
		    e.cancelBubble = true;
		    if (GetUAgentMainScript() != "") {
		        SearchProducts_WAP();
		    }
		    else {

		        SearchProducts();
		        removeElement('SlidePagingContainer', 'ACTIVECOMMANDS', '_TabsContainer', 'SUB_CATEGORIES'); 
		        SlideShow_Stop();
		    }
		} 
	}
	else 
	{
		if(e.keyCode==13)
		{
		    e.stopPropagation();		   
		if (GetUAgentMainScript() != "") {
		    SearchProducts_WAP();
		}
		else {

		    SearchProducts();
		}
		}
}

}


/*
function SetVar()
{
	var SetRelative = '1';
}
*/

function SetRelatedBack()
{
	if (SetRelative == '2')
	{
		//history.go(-1);
		SetRelative = '1';
	}
}
function homeRedirect()
{
	//var t=setTimeout("showMenuFav()",4000);
	//showMenuFav();
	switchRedirection('../default.aspx','../waptxt_default.aspx');
	
	
}
function parentURL()
{
	
	if(framehistory == "undefined")
	{
		try{
			framehistory = window.frames["frame_details"].location.href;	
		}
		catch(ex){
			// SET BLANKPAGE IF THE FILE NOT FOUND
			//framehistory = "http://" + window.location.host + "/blank.htm";
		}
	}
}
function re_ParentProduct()
{
	
	if ((BackProImg == "ProImg") && (framehistory != "undefined"))
	{
		//window.frames["frame_details"].location = framehistory;
		window.frames["frame_details"].location.replace(framehistory);
		framehistory = "undefined";
		//framehistory = window.frames["frame_details"].location;
		//window.frames["frame_details"].location = framehistory;
		//window.frames["frame_details"].history.go(-1);
		
		//framehistory = this.parent.window.frames["frame_details"].location;
		//framehistory.src = "blank.htm";
		//framehistory.history.go(-1);
		//framehistory = window.frames["frame_details"];
		//framehistory.history.back(-1);
		//window.frames.frame_details.history.back();
	}
}
function BackPro()
{
	
	BackProImg = "ProImg";
}
function myinit()
{
	if((homePagebanner_Process1 == "Process") && (homePagebanner_Process2 == "Process"))
	{
		//document.getElementById("Layer1").style.visibility = "hidden";
		//document.getElementById("loadingLayer").style.display = "block";
	}
	else if((homePagebanner_Process1 == "Done") && (homePagebanner_Process2 == "Done"))
	{
		//document.getElementById("Layer1").style.visibility = "visible";
		//document.getElementById("loadingLayer").style.display = "none";
	}
}
function LoadProductCmdAgain()
{
	//LoadProductCommands(productCmdQuerry);
	LoadSlideShowCommands();
}

function LoadQuestionCommands_ActivationProducts()
{
	var xmlRequest = DoCallback(_Domain + "/AJAX/QuestionCommands_AP.aspx", "");
	document.getElementById("ACTIVECOMMANDS").innerHTML = xmlRequest.responseText;
	document.getElementById("ACTIVECOMMANDS").style.visibility = 'visible';
	if(_wizardGlobalChk == "Wizard,WithOutSearch" ||  _wizardGlobalChk == "Wizard,WithSearch")
	{
		FinalRelatedProduct(currentRelatedProId);
		//parent.document.getElementById("RelatedProductDiv").style.display = "block";
//		parent.document.getElementById("relatedPro").innerHTML=_resWizardPro;
	}
}
function FinalRelatedProduct(CurrentproId)
{
	if(BackProImg != "ProImg")
	{
		var params;
		//params = "?CurrentProId="+CurrentproId;
		params = "?CurrentProId=" + CurrentproId + uAgent;
		
		// iPhone Change
		//document.getElementById("RelatedProductDiv").style.top = topCategory + 10;
		//document.getElementById("RelatedProductDiv").style.left = leftCategory + 5;
		// end iPhone Change
			
		document.getElementById("RelatedProductDiv").style.top = getDynamicPositions("RelatedProductDiv",(topCategory + 10),(topCategory + 10))["y"];
		document.getElementById("RelatedProductDiv").style.left = getDynamicPositions("RelatedProductDiv",(topCategory + 10),(topCategory + 5))["x"];
		
		
		document.getElementById("RelatedProductDiv").innerHTML = frameLoading;
		var _RelatedResult;
		var req=null;
		req=initXMLHTTPRequest();
		if (req)
		{
		    //Commented By Zeeshan for mobile application optimization on - 4 oct 2010
		    //req.open("POST",_Domain + "/AJAX/RelatedProduct.aspx"+ params,true);
		    req.open("GET", _Domain + "/AJAX/RelatedProduct.aspx" + params, true);
			req.onreadystatechange=function()
			{
				var ready=req.readyState;
				var data=null;
				if (ready==4)
				{
					xmlResult = req.responseText;
					//_RelatedResult = xmlResult;
					if (xmlResult == "No Data")
					{
						_RelatedResult = xmlResult;
						document.getElementById("RelatedProductDiv").style.display = 'none';
					}
					else
					{
						document.getElementById("RelatedProductDiv").style.display = "block";
						document.getElementById("RelatedProductDiv").innerHTML=xmlResult;
						
						initArrow('reletedProducts');
						var lengthArr;
						lengthArr = document.getElementById("arrayLength").innerText;
						lengthArr = lengthArr;
						relatedProductLength = new Array(lengthArr);
						for (var i=0; i<lengthArr;i++)
						{
							if(document.getElementById("RelatedCheckBox"+i).checked == true)
							{
								relatedProductLength[i] = document.getElementById("RelatedCheckBox"+i).value;
							}
							else
							{
								//relatedProductLength[i] = null;
								relatedProductLength.splice(0,1);
							}
						}
					}
				}
				else
				{
					document.getElementById("RelatedProductDiv").innerHTML=frameLoading;
				}
			}
			//Commented By Zeeshan for mobile application optimization on - 4 oct 2010
			//req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			req.send("");
			BackProImg = "ProImginit";
		}
	}
	else
	{
		BackProImg = "ProImginit";
	}
}

function LoadCommands_DomainRegistration(arg)
{

	var xmlRequest;
	
	if (arg != null)
	{
		if (CurrentProductPrice == "0.00")
		{
			xmlRequest = DoCallback(_Domain + "/AJAX/Commands_DomainRegistration.aspx", "?product_id=" + CurrentProductID + "&WithProceed=true");
		}
		else
		{
			xmlRequest = DoCallback(_Domain + "/AJAX/Commands_DomainRegistration.aspx", "?product_id=" + CurrentProductID + "&price=" + CurrentProductPrice + "&WithProceed=true");
		}
	}
	else
	{
		if (CurrentProductPrice == "0.00")
		{
			xmlRequest = DoCallback(_Domain + "/AJAX/Commands_DomainRegistration.aspx", "?product_id=" + CurrentProductID);
		}
		else
		{
			xmlRequest = DoCallback(_Domain + "/AJAX/Commands_DomainRegistration.aspx", "?product_id=" + CurrentProductID + "&price=" + CurrentProductPrice);
		}
	}
	
	document.getElementById("ACTIVECOMMANDS").innerHTML = xmlRequest.responseText;
	document.getElementById("ACTIVECOMMANDS").style.visibility = 'visible';
	
}

function LoadCommands_CompanyFormation(arg)
{

	var xmlRequest;
	
	if (arg != null)
	{
		if (CurrentProductPrice == "0.00")
		{
			xmlRequest = DoCallback(_Domain +  "/AJAX/Commands_CompanyFormation.aspx", "?product_id=" + CurrentProductID + "&WithProceed=true");
		}
		else
		{
			xmlRequest = DoCallback(_Domain + "/AJAX/Commands_CompanyFormation.aspx", "?product_id=" + CurrentProductID + "&price=" + CurrentProductPrice + "&WithProceed=true");
		}
	}
	else
	{
		if (CurrentProductPrice == "0.00")
		{
			xmlRequest = DoCallback(_Domain + "/AJAX/Commands_CompanyFormation.aspx", "?product_id=" + CurrentProductID);
		}
		else
		{
			xmlRequest = DoCallback(_Domain + "/AJAX/Commands_CompanyFormation.aspx", "?product_id=" + CurrentProductID + "&price=" + CurrentProductPrice);
		}
	}
	
	document.getElementById("ACTIVECOMMANDS").innerHTML = xmlRequest.responseText;
	document.getElementById("ACTIVECOMMANDS").style.visibility = 'visible';
	
}

function ProcessCommand(arg)
{
	
	if (arg == "CheckCompany")
	{

		//var companyName = window.top.frames["frame_details"].UIMainForm.companyname.value;
		var companyName = GetBrowserIndendentElementForDocument(window.top.frames["frame_details"].document,"companyName")
		//var companyName = window.top.frames["frame_details"].document.getElementById("UIMainForm").companyname.value;		
		//var companyPattern = new RegExp("^[a-zA-Z0-9\-.]+$");
		//if(companyName.match(companyPattern) == null)
		if(companyName == null || companyName == "")
		{
			window.alert("Please Enter Valid Company Name");
			parent.ShowHideProductCommands('Product', parent.CurrentProductID, '?product_id=' + parent.CurrentProductID, null, 'search');
			parent.document.getElementById("RelatedProductDiv").style.display = 'none';
			return;
		}
		else
		{
			/** FinalRelatedProduct(currentRelatedProId);
			Onrelatedpro();
			window.top.frames["frame_details"].SetArgument(arg);
			window.top.frames["frame_details"].Submit(); **/
			parent.ShowHideProductCommands('Product', parent.CurrentProductID, '?product_id=' + parent.CurrentProductID, null, 'search');
			parent.document.getElementById("RelatedProductDiv").style.display = 'none';
			return;
		}	
	
	}
	
	if (arg == "ProceedCompany")
	{
		window.top.frames["frame_details"].SetArgument(arg);
		window.top.frames["frame_details"].Submit();
		return;
	}
	
	if (arg == "Check")
	{
		//var domainName = window.top.frames["frame_details"].UIMainForm.domainname.value;
		var domainName  = window.top.frames["frame_details"].document.getElementById("UIMainForm").domainname.value;
		var domainPattern = new RegExp("^[a-zA-Z0-9\-]+$");
		if(domainName.match(domainPattern) == null)
		{
			window.alert("Please Enter Valid Domain Name");
			return;
		}
		else
		{
			FinalRelatedProduct(currentRelatedProId);
			Onrelatedpro();
			window.top.frames["frame_details"].SetArgument(arg);
			window.top.frames["frame_details"].Submit();
			return;
		}
	}
	
	var DomainStatus;
	var DomainName;
	
	if (arg == "Proceed")
	{
		
		//var RequestedDomains = window.top.frames["frame_details"].UIMainForm.RequestedDomains;
		var RequestedDomains = window.top.frames["frame_details"].document.getElementById("UIMainForm").RequestedDomains;
		if (RequestedDomains.length != null)
		{
			for (i = 0; i < RequestedDomains.length; i++)
			{
				var SelectedDomain = RequestedDomains[i];
				DomainStatus = SelectedDomain.checked;
				if (DomainStatus == true)
				{
					DomainName = SelectedDomain.value;
					break;
				}
			}
		}
		else
		{
			DomainStatus = RequestedDomains.checked;
			if (DomainStatus == true)
			{
				DomainName = RequestedDomains.value;
			}
		}
		
		if (DomainStatus)
		{
			window.top.frames["frame_details"].SetArgument(arg);
			window.top.frames["frame_details"].Submit();		
			return;
		}
		else
		{
			window.alert("Please Select Desired Domain Name or Search for a new domain!");
			return;
		}
		
	}
}


function Onrelatedpro()
{
	
	if ((_wizardGlobalChk == "Wizard,WithOutSearch" ||  _wizardGlobalChk == "Wizard,WithSearch") && _relatedresultchk != "No Data")
	{
	    //RelatedProduct(currentRelatedProId);
	        document.getElementById("RelatedProductDiv").style.display = 'block';
	}
	else {
	    
		document.getElementById("RelatedProductDiv").style.display = 'none';
	}
	if (GetUAgentMainScript() == "") {

	    myMainCategoryMoving();
	}
	
	
}
function totalPriceRemover()
{
	//var xmlRequest = DoCallback("AJAX/remove_total.aspx","");
	var req=null;
	req=initXMLHTTPRequest();
	if (req)
	{
		req.open("GET","AJAX/remove_total.aspx",true);
		req.onreadystatechange=function()
		{
			var ready=req.readyState;
			var data=null;
			if (ready==4)
			{
			}
			else
			{
			}
		}
		//req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		req.send("");
	}
}


// DONE BY ASHER SYED FOR BUYING EQUOTE PRODUCTS
// MODIFIED BY ASHER SYED FOR BUYING EQUOTE PRODUCTS ON 20080107

function CheckEQuoteQueryString()
{
	
	var Customer = queryString("customer");
	var Product = queryString("product");
	var Action = queryString("action");

	if (Customer != "false" && Product != "false" && Action != "false")
	{
		var request = new XMLHttpRequest();
		
		if (request) 
		{ 
			request.onreadystatechange = function() {
				if( request.readyState == 4 )
				{
					
					document.getElementById("DIV_LIST").innerHTML = request.responseText;
					document.getElementById("DIV_LIST").style.visibility = 'visible';
					SetObjectSize("DIV_LIST", 226, 100);
					initArrow('searchRes');
					topLayerShow();
					CurrentProductID = Product;
					DisplayEQuoteProduct(CurrentProductID);
					
				}
			}
			
			request.open('POST', EQuotePage + "?customer=" + Customer + "&product=" + Product + "&action=" + Action );
			request.send("");
		}
		
		return true;
	}
	else
	{
		return false;
	}
}

//END DONE BY ASHER SYED FOR EQUOTE PRODUCTS


function LoadInfiniOffice() {
    var d = new Date();
    var Day = d.getDate();
    var Month = d.getMonth();
    var year = d.getFullYear();
    var hour = d.getHours();
    var min = d.getMinutes();
    var sec = d.getSeconds();
    var milisec = d.getMilliseconds();
    InfiniOfficePage = InfiniOfficePage + '?t=' + Day + Month + year + hour + min + sec + milisec;
    var request = initXMLHTTPRequest();
    GetBrowserIndependentElement("Container_InfiniOffice").style.visibility = 'visible';
    if (request) {
        request.onreadystatechange = function() {
            if (request.readyState == 4) {
                //GetBrowserIndependentElement("Container_InfiniOffice").style.visibility = 'visible';
                GetBrowserIndependentElement("Container_InfiniOffice").innerHTML = request.responseText;
                //GetBrowserIndependentElement("InfiniOffice1_InfiniOffice").style.width = '100%';
                //GetBrowserIndependentElement("InfiniOffice1_InfiniOffice").style.height = '100%';
            }
            else {
                GetBrowserIndependentElement("Container_InfiniOffice").innerHTML = loadPagesImageNew;
            }
        }
        request.open('GET', InfiniOfficePage, true);
        //request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        if (BrowserDetect.browser != "Safari" && BrowserDetect.browser != "Opera") {
            //request.setRequestHeader("Content-length", 0);
            //request.setRequestHeader("Connection","close");
        }
        request.send("");
    }
}



function LoadTicketInfiniOffice() {
    var request = initXMLHTTPRequest();
    GetBrowserIndependentElement("Container_InfiniOffice").style.visibility = 'visible';
    if (request) {
        request.onreadystatechange = function() {
            if (request.readyState == 4) {
                //GetBrowserIndependentElement("Container_InfiniOffice").style.visibility = 'visible';
                GetBrowserIndependentElement("Container_InfiniOffice").innerHTML = request.responseText;
                //GetBrowserIndependentElement("InfiniOffice1_InfiniOffice").style.width = '100%';
                //GetBrowserIndependentElement("InfiniOffice1_InfiniOffice").style.height = '100%';
            }
            else {
                GetBrowserIndependentElement("Container_InfiniOffice").innerHTML = loadPagesImageNew;
            }
        }
        request.open('POST', '../mobile/InfiniOfficeTicket.aspx', true);
        request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
        if (BrowserDetect.browser != "Safari" && BrowserDetect.browser != "Opera") {
            request.setRequestHeader("Content-length", 0);
            request.setRequestHeader("Connection", "close");
        }
        request.send("");
    }
}


function catImageChange(catId,imageUrl,status,catPathId)
{
	if(status == "hover")
	{
		
		if(_mainCateId != null)
		{
			//_mainCateId.src = 'http://www.'+document.domain+'/cat_files/'+_mainCatImage+'/cat_textImg/simple.jpg';
			_mainCateId.src = '../cat_files/'+_mainCatImage+'/cat_textImg/simple.gif';
			_mainCateId = null;

		}
		else
		{
			catId.src = imageUrl;
			_mainCateId = catId;
			//_mainCateId.src = 'http://www.'+document.domain+'/cat_files/'+_mainCatImage+'/cat_textImg/simple.jpg';
		//	_mainCateId.src = '../cat_files/'+_mainCatImage+'/cat_textImg/simple.jpg';

		}
		//_mainCateId = catId;
		_mainCatImage = catPathId;
	}
}
function testredirect(_URLME)
{
	window.location.href = _URLME;
}

function CalculateAmount_WizardProduct(WizardID)
{
	//getIPhoneIViewFor("CalculateAmount_WizardProduct");
	try
	{
		if (parent.WizardLevelCount > 0)
		{
			//getIPhoneIViewFor("CalculateAmount_WizardProduct");
			var LinkCode = "";
			for (var counter = 1; counter <= parent.WizardLevelCount; counter++)
			{
				var WizardControl;
				WizardControl = GetBrowserIndendentElementForDocument(parent.window.frames["frame_details"].document, WizCtrlName + "_ddl_" + counter.toString());
				if (WizardControl == null)
				{
					WizardControl = GetBrowserIndendentElementForDocument(parent.window.frames["frame_details"].document, WizCtrlName + "_rbl_" + counter.toString());
				}
		
				switch (WizardControl.id.substr(WizCtrlName.length,5))
				{
					case "_ddl_":
						LinkCode += "." + GetComboValue(WizardControl);
						break;
					case "_rbl_":
						LinkCode += "." + GetRadioButtonListValue(WizardControl);
						break;
				}
			}
			
			var url = "http://" + location.hostname + "/Utility.asmx";
			//var params = "<WizardID>" + WizardID.toString() + "</WizardID><LinkCode>" + LinkCode.toString() + "</LinkCode>";
			var params = "<WizardID>" + WizardID.toString() + "</WizardID><LinkCode>" + LinkCode.toString() + "</LinkCode><ProductID>" + parent.CurrentProductID + "</ProductID>";
			var xmlRequest = RemoteCallWebService(url, "business4less.com", "GetProductPrice_WizardProduct", params);
			
			var TotalAmount = ParseXMLResponse(xmlRequest);
			var HTML_Control_For_TotalAmount = GetBrowserIndendentElementForDocument(parent.window.frames["frame_details"].document, "TotalAmount");
			if (HTML_Control_For_TotalAmount != null)
			{
				HTML_Control_For_TotalAmount.innerHTML = TotalAmount.toString();
			}

		}
	}
	catch(ex)
	{
		alert(GetErrorMessage(ex)); 
	}
}


function GetComboValue(combo)
{
	try
	{
		var selIndex = combo.selectedIndex;
		var selValue = combo.options[selIndex].value;
		var selText = combo.options[selIndex].text;
		if (selValue != null)
		{
			return selValue;
		}
		else
		{
			return 0;
		}
	}
	catch(ex)
	{
		alert(ex.toString());
		return 0;
	}
}

function GetRadioButtonListValue(radiobuttonlist)
{
	try
	{
		var selOpt;
		var OptionStatus;
		for (i = 0; i < radiobuttonlist.rows.length; i++)
		{
			selOpt = radiobuttonlist.rows(i).cells(0).childNodes(0)
			OptionStatus = selOpt.checked;
			if (OptionStatus == true)
			{
				return selOpt.value;
				break;
			}
		}
	}
	catch(ex)
	{
		alert(ex.toString());
		return 0;
	}
}


//DONE BY ASHER SYED ON 20071218 FOR DEFAULT SELECTED COUNTRY IN PRODUCT CONFIG WIZARD

function ChangeDefaultSelectedCountry()
{
	
	try
	{
		if (parent.WizardLevelCount > 0)
		{
			for (var counter = 1; counter <= parent.WizardLevelCount; counter++)
			{
				var WizardControl;
				
				WizardControl = GetBrowserIndendentElementForDocument(parent.window.frames["frame_details"].document, WizCtrlName + "_ddl_" + counter.toString());
				if (WizardControl != null)
				{
					switch (WizardControl.id.substr(WizCtrlName.length,5))
					{
						case "_ddl_":
							var selIndex = CheckComboOptions(WizardControl);
							if (selIndex != null)
							{
								WizardControl.options[selIndex].selected = true;
								var staticBody = 'function anonymous()';
								var functionBody = WizardControl.onchange.toString();
								var firstBracket = functionBody.indexOf("{");
								functionBody = functionBody.substring(firstBracket + 1, functionBody.length - 1)
								setTimeout(functionBody, 500);
							}
							break;
					}
				}
			}
		}
	}
	catch(ex)
	{ 
		alert(GetErrorMessage(ex));
	}
}

function CheckComboOptions(combo)
{
	try
	{
		for (var i = 0; i < combo.options.length; i++)
		{
			if (combo.options[i].text.toUpperCase() == 'UNITED KINGDOM')
			{
				return i;
			}
		}
		return null;
	}
	catch(ex){ alert(ex.toString()); }
}


//END DONE BY ASHER SYED ON 20071218 FOR DEFAULT SELECTED COUNTRY IN PRODUCT CONFIG WIZARD

// DONE BY ASHER SYED ON 20080107 FOR EQUOTE PRODUCT DISPLAY

function DisplayEQuoteProduct(ProductID)
{
	
	spaceRow(); 
	ShowHideProductCommands('Product', ProductID, '?product_id=' + ProductID, ProductID, 'search');
	downslide();
}

// END DONE BY ASHER SYED ON 20080107 FOR EQUOTE PRODUCT DISPLAY

// DONE BY TALHA AHMED ON 20080116 FOR DISABLING BROWSERS BACK BUTTON
function backButtonOverride()
{
  // Work around a Safari bug
  // that sometimes produces a blank page
  setTimeout("backButtonOverrideBody()", 1);

}

function backButtonOverrideBody()
{
  // Works if we backed up to get here
  try {
	//history.clear();
    history.forward();
    //window.location.replace("www.business4less.com");
    //window.frames["frame_details"].history.forward();
    //window.frames['frame_details'].history.forward();
    //var ifrm = document.getElementById("frame_details");
	//ifrm.history.forward();
  } catch (e) {
    // OK to ignore
  }
  // Every quarter-second, try again. The only
  // guaranteed method for Opera, Firefox,
  // and Safari, which don't always call
  // onLoad but *do* resume any timers when
  // returning to a page
  setTimeout("backButtonOverrideBody()", 500);
}

// END DONE BY TALHA AHMED ON 20080116 FOR DISABLING BROWSERS BACK BUTTON

// DONE BY USMAN MAHAMMAD ON 20080118 FOR POPUP WINDOW OPEN

function PopupWin(URL,HT,WD)
{
var winname = 'Contact_Us' + Math.floor(Math.random()*11);
window.open(URL, winname ,"menubar=no,location=no,resizable=no,scrollbars=no,status=no, height=" + HT + " , width=" + WD + "");

}

function GetURL(P_URLID)
{
//var URL window.location.href;
//var Sp_URL = URL.split("/");
//var ID=225844;
window.location = "../default.aspx?ProURL_ID="+P_URLID;
}

//DONE BY USMAN MAHAMMAD ON 20080118 FOR SHARE URL 23-01-2008(Modify at 03.03.2008)

function GetSharedURL()
{
	try
	{
	//=======================
		//var UL = parent.window.frames["frame_details"].location.href;
		//var SPUrl = UL.split("/");
		//var Pro_NewID = SPUrl[4];
		
		//document.getElementById('SharedURL').style.display = "block";
		//document.getElementById('SharedURL').value = "http://" + fullDomainName + "?ProURL_ID=" + Pro_NewID;
	//=======================
		//	SetSource('../AJAX/Shared_URL.aspx?Pro_ID_New='+Pro_NewID);
		//Stop();
		//SetSourceWithCommands('../AJAX/Shared_URL.aspx?Pro_ID_New='+Pro_NewID);
		//SetSourceWithCommands('../AJAX/Shared_URL.aspx?Pro_ID_New='+ FavproductId);
		SetSourceWithCommands('../AJAX/Shared_URL.aspx?Pro_ID_New='+ CurrentProductID);
	}
	catch(err){
	}
}
function SetURL()
{
	
	document.getElementById("SharedURL1_Pro_Name").style.display = "none";
	var SURL = window.location.href;
	var SPUrl_New = SURL.split("?");
	for (var i=0;i<SPUrl_New.length;i++) 
	{ 
		var spair = SPUrl_New[i].split("=");
		if (spair[0] == "Pro_ID_New" || spair[0] == "pro_id_new") 
				{ 
					var Pro_NewID = spair[1];
				}
	} 
	Pro_NewID = spair[1];
	Comp_URL = "http://" + fullDomainName + "/default.aspx?ProURL_ID=" + Pro_NewID;
	Comp_URL_Fav = "http://" + fullDomainName + "/default.aspx?ProURL_ID=" + Pro_NewID;
	var U_ID = document.getElementById("SLink");
	//var HU_ID = document.getElementById("H_email");
	if (U_ID)
	{
		document.getElementById("SLink").innerHTML = Comp_URL;
	}
	//var P_Nm;
	//P_Nm = document.getElementById("Pro_Name").value
	
		
	
		
	}
//Done Function Modify by Usman For Product Name with title 06.03.2008
	
function BookMarkUrl()
{

	var P_Nm;
	P_Nm = document.getElementById("SharedURL1_Pro_Name").value;
	var SURL = window.location.href;
	var SPUrl_New = SURL.split("?");
	for (var i=0;i<SPUrl_New.length;i++) 
	{ 
		var spair = SPUrl_New[i].split("=");
		if (spair[0] == "Pro_ID_New" || spair[0] == "pro_id_new") 
				{ 
					var Pro_NewID = spair[1];
				}
	} 
	Pro_NewID = spair[1];
	var DOM = document.domain;
	var SpDOM = DOM.split(".");
	URL_Fav = Comp_URL_Fav;
	addtoLayout='1';					      
	addtoMethod=1;						     // addtoMethod: 0=direct link, 1=popup 
	AddURLSimple = Comp_URL;
	AddURL = encodeURIComponent(Comp_URL);	// could be set dynamically to your blog post's permalink
	AddTitle = escape(SpDOM[0]);	       // same here, this could be set dymaically instead of the page's current title
	//AddTitle = AddTitle + "-Product(" + Pro_NewID + ")";
	// Add For title First Letter Capital By Usman 06.03.2008
	var index;
	var tmpStr;
	var tmpChar;
	var preString;
	var postString;
	var strlen;
	tmpStr = AddTitle.toLowerCase();
	strLen = tmpStr.length;
	if (strLen > 0)  {
	for (index = 0; index < strLen; index++)  {
	if (index == 0)  {
	tmpChar = tmpStr.substring(0,1).toUpperCase();
	postString = tmpStr.substring(1,strLen);
	tmpStr = tmpChar + postString;
	}
	else {
	tmpChar = tmpStr.substring(index, index+1);
	if (tmpChar == " " && index < (strLen-1))  {
	tmpChar = tmpStr.substring(index+1, index+2).toUpperCase();
	preString = tmpStr.substring(0, index+1);
	postString = tmpStr.substring(index+2,strLen);
	tmpStr = preString + tmpChar + postString;
			}
		}
	}
	}
	AddTitle = tmpStr;
	AddTitle = AddTitle + " - " + P_Nm ;
	// End Add For title First Letter Capital By Usman 06.03.2008
	//AddTitle = AddTitle.toUpperCase();

}
//End Function Modify by Usman For Product Name with title 06.03.2008

function addfav()
{
BookMarkUrl();
parent.window.external.AddFavorite(URL_Fav, AddTitle);
}


//END DONE BY USMAN MAHAMMAD ON 20080118 FOR SHARE URL 23-01-2008	(Modify at 03.03.2008)


/*	
	Horizontal Menu Start 
	two Global var	
	var dom = document.getElementById?1:0;
	var ns4 = document.layers?1:0;
	SHAHZEB : 
*/

function H_MenuControlHeading(cat)
{
	var currentCat;
	currentCat = "?currentCat="+cat;
	var req=null;
	req=initXMLHTTPRequest();
	downLayer = "blank";
	if (req)
	{
		req.open("POST","AJAX/h_Cat_main.aspx"+currentCat,true);
		req.onreadystatechange=function()
		{
			var ready=req.readyState;
			var data=null;
			if (ready==4)
			{
				document.getElementById("stackText").innerHTML= "";
				document.getElementById("stackText").innerHTML=req.responseText;
				h_Initialize();
			}
			else
			{
				//document.getElementById("stackText").innerHTML=loadPagesImage;
			}
		}
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		req.send("");
	}
}
var downLayer;
downLayer = "blank";
function H_MenuControlDown(cat)
{
	var h_yPos;
	var h_xPos;
	h_yPos = findPosY(document.getElementById("stackText"));
	h_xPos = findPosX(document.getElementById("stackText"));
	document.getElementById("h_dropdown").style.top = h_yPos + 20 ;
	document.getElementById("h_dropdown").style.left = h_xPos;
	document.getElementById("h_dropdown").style.display = "block";
	document.getElementById("h_dropdown").innerHTML=loadPagesImage;
	
	var currentCat;
	currentCat = "?currentCat="+cat;
	var req=null;
	req=initXMLHTTPRequest();
	if (req)
	{
		req.open("POST","AJAX/h_Cat_down.aspx"+currentCat,true);
		req.onreadystatechange=function()
		{
			var ready=req.readyState;
			var data=null;
			if (ready==4)
			{
				document.getElementById("h_dropdown").style.top = h_yPos + 20 ;
				document.getElementById("h_dropdown").style.left = h_xPos;
				document.getElementById("h_dropdown").style.display = "block";
				document.getElementById("h_dropdown").innerHTML=req.responseText;
				downLayer = "data";
			}
			else
			{
				document.getElementById("h_dropdown").style.top = h_yPos + 20 ;
				document.getElementById("h_dropdown").style.left = h_xPos;
				document.getElementById("h_dropdown").style.display = "block";
				document.getElementById("h_dropdown").innerHTML=loadPagesImage;
			}
		}
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		req.send("");
	}
}
function h_Menuhide()
{
	if(downLayer == "data")
	{
		document.getElementById("h_dropdown").style.display = "none";
	}
	else if(downLayer == "blank")
	{
		document.getElementById("h_dropdown").style.display = "block";
	}
}
function horizontal_Menuhide()
{
	if(document.getElementById("h_dropdown").style.display == "block")
	{
		document.getElementById("h_dropdown").style.display = "none";
	}	
}
function h_MenuhideOnProduct()
{
	//document.getElementById("stackText").innerHTML= "";
	document.getElementById("h_dropdown").innerHTML = "";
	document.getElementById("h_dropdown").style.display = "none";
}
function h_Initialize()
{
	if (dom) 
	{
		layer = document.getElementById("h_contectText").getElementsByTagName("table");
		layer['h_contectFirst'].style.visibility = "visible";
		layer['h_contectFirst'].style.left = 0;
	}
	else if(ns4) 
	{
		layer = "document['h_contectText'].document";
		eval(layer + "['h_contectFirst']" + '.visibility = "visible"');
		eval(layer + "['h_contectFirst']" + '.left = -15');
	}
}

function h_scroll(direction, speed) 
{

	if (dom) 
	{
		var layertop = parseInt(layer[present].style.left);
//		var h_scrollheight = (document.getElementById('h_contectText').offsetHeight - layer[present].offsetHeight);
		var h_scrollheight = (document.getElementById('h_contectText').offsetWidth - layer[present].offsetWidth);
	}

	else if (ns4) 
	{
		var layertop = parseInt(document['h_contectText'].document[present].left);
		var h_scrollheight = (document['h_contectText'].clip.width - document['h_contectText'].document[present].clip.width);
	}

	if (direction == "left" && layertop - 10 > h_scrollheight) 
	{
		if (dom) 
			//layer[present].style.top = (layertop - speed) + "px";
			layer[present].style.left = (layertop - speed) + "px";
		else if(ns4) 
		document['h_contectText'].document[present].top = (layertop - speed);
	}	
	else if (direction == "right" && layertop < -10 )
	{
		if(dom)
			layer[present].style.left = (layertop + speed) + "px";
		else if(ns4)
			document['h_contectText'].document[present].right = (layertop + speed);
	}
	timer = setTimeout("h_scroll('" + direction + "', " + speed + ")", 10);
}
function h_stop() 
{
	clearTimeout(timer);
}
function H_MenuHeadChng(cat, _URL)
{
	if( (_URL != "") && (_URL != "javascript:") )
	{
		document.getElementById("stackText").innerHTML = redirectURL;
		window.location.href=_URL;
		document.getElementById("h_dropdown").style.display = "none";
	}
	else if(_URL == "javascript:")
	{
		var currentCat;
		currentCat = "?currentCat="+cat;
		var req=null;
		req=initXMLHTTPRequest();
		if (req)
		{
			req.open("POST","AJAX/h_Cat_upClicked.aspx"+currentCat,true);
			req.onreadystatechange=function()
			{
				var ready=req.readyState;
				var data=null;
				if (ready==4)
				{
					document.getElementById("stackText").innerHTML= "";
					document.getElementById("stackText").innerHTML=req.responseText;
					//h_Initialize();
				}
				else
				{
					document.getElementById("stackText").innerHTML=loadPagesImage;
				}
			}
			req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			req.send("")
		}
	}	
}
function H_MenuBackButton(myID,parentId)
{
	if(parentId == 1 || parentId == "root" )
	{
		H_MenuControlHeading(parentId)
	}
	else
	{
		H_MenuHeadChng(parentId,"javascript:");
	}
}
function chngCatImageHvr(h_catIMG)
{
	var Cat_img_src;
	Cat_img_src = "../images/H_Menu_Images/category_bullet_over.jpg"
	document.getElementById(h_catIMG).src = Cat_img_src;
}
function chngCatImageOut(h_catIMG)
{
	var Cat_img_src;
	Cat_img_src = "../images/H_Menu_Images/category_bullet.jpg"
	document.getElementById(h_catIMG).src = Cat_img_src;
}
function chngProImageHvr(h_catIMG)
{
	var Cat_img_src;
	Cat_img_src = "../images/H_Menu_Images/product_bullet_hover.jpg"
	document.getElementById(h_catIMG).src = Cat_img_src;
}
function chngProImageOut(h_catIMG)
{
	var Cat_img_src;
	Cat_img_src = "../images/H_Menu_Images/product_bullet.jpg"
	document.getElementById(h_catIMG).src = Cat_img_src;
}
/*	Horizontal Menu End */
/*	Favorites */
function GetFavProductId()
{
	
	
	try
	{
	//=======================
		var UL = parent.window.frames["frame_details"].location.href;
		var SPUrl = UL.split("/");
		var Pro_NewID = SPUrl[4];
	}
	catch(err)
	{
	}
}

//==================================================================================================
//S.Zeeshan 24-01-08
//Read Cookie, parse UserID for WebTracker and Page URL Request For WebTracker 
//Reference "text.js" file script/

function SetCookie() {
if(arguments.length < 2) { return; }
var n = arguments[0];
var v = arguments[1];
var d = 0;
if(arguments.length > 2) { d = parseInt(arguments[2]); }
var exp = '';
if(d > 0) {
	var now = new Date();
	then = now.getTime() + (d * 24 * 60 * 60 * 1000);
	now.setTime(then);
	exp = '; expires=' + now.toGMTString();
	}
document.cookie = n + "=" + escape(String(v)) + '; path=/' + exp;
} 
// function SetCookie()

function ReadCookie(n) {
var cookiecontent = new String();
if(document.cookie.length > 0) {
	var cookiename = n+ '=';
	var cookiebegin = document.cookie.indexOf(cookiename);
	var cookieend = 0;
	if(cookiebegin > -1) {
		cookiebegin += cookiename.length;
		cookieend = document.cookie.indexOf(";",cookiebegin);
		if(cookieend < cookiebegin) { cookieend = document.cookie.length; }
		cookiecontent = document.cookie.substring(cookiebegin,cookieend);
		}
	}
return unescape(cookiecontent);
} 
// function ReadCookie()
// —>

function setCookie()
{
	var acookie = ReadCookie("infiniCookie");
	return Parser(acookie);
}

function Parser(str){
	var parseCookie = new String(str) 
	if(parseCookie != "")
	{
		var splitCookie = parseCookie.split("=");
		var parseUserId = splitCookie[1].split("&");
		var parseJabberId = splitCookie[3]
		var visterID = parseUserId[0];
		postURL(visterID)
		
	}	
}

function postURL(visiterId)
{
	var tempurl,tempStr,strLth;
	var newlth;
	tempurl = document.location.href;
	tempurl = tempurl.substring(7,tempurl.length);
	var tempStr = tempurl.split("/");
	var value = "http://"+tempStr[0]+"/tracker/tracker.aspx?referrer=" + escape(document.referrer);
	//var value = "http://tracker.infinishops.com/tracker.aspx?referrer=" + escape(document.referrer);
	var docLocation = document.location.href; 
	value+="&customerId="+visiterId;
	if(readJabberCookie("InfiniCustomerJabberId") != null)
	{
		docLocation += "&customerId="+visiterId+"&customerJID="+
		readJabberCookie("InfiniCustomerJabberId")+"&operatorJID="+
		readJabberCookie("InfiniCustomerOpreatorId"); 
		}
	value += "&location=" + escape(docLocation);
	var html_doc = document.getElementsByTagName("head").item(0);
	var scriptTag = document.createElement("SCRIPT");
	scriptTag.src = value;
	html_doc.appendChild(scriptTag);
	}

//setCookie();

// End Web Tracker Call
//=======================================================================================================
function favProductRender()
{

    /*favTop = getDynamicPositions("hisProductRender")["y"];
    favLeft = getDynamicPositions("hisProductRender")["x"];
    removeElement("HistoryProductDiv");
    if (GetUserAgent() != "") {
        removeElement("RelatedProductDiv");
    }
    var fav = GetElement("FavouriteProductDiv");
    fav.style.top = favTop + 30;
    fav.style.left = favLeft - 0;
    AjaxCall("FavouriteProductDiv", "/AJAX/FavBarResult.aspx", "");
    fav.style.display = 'none';*/
    AjaxCall("FavouriteProductDiv", "/AJAX/FavBarResult.aspx", "");
    removeElement("HistoryProductDiv");
    removeElement("FavouriteProductDiv");
} 









// Done By Usman For Browser Version Check 20.02.2008



function CheckBrowser(chkTOP)
{
	catComView = chkTOP;
	//catComView = "topper";
	
	var version=0
	var browserName=navigator.appName; 
	//var browserVer=navigator.appVersion; 
	if (navigator.appVersion.indexOf("MSIE")!= -1)
	{
		temp=navigator.appVersion.split("MSIE")
		version=parseFloat(temp[1])
	}
	if (browserName=="Microsoft Internet Explorer" && version >= 5.5)
	{ 
		//document.getElementById("loadingLayer").style.display = "block";
			init();
		myMainCategoryMoving();
		renderFavouriteBar();
		renderHistoryBar();
		//chatroomImageShow();
		//LoadSupport();
		ContactInfo();
		SelectDefaultLanguage();
	
	}
	else
	{
	// document.getElementById("loadingLayer").style.display = "none";
	 document.getElementById("CheckBrowser").style.display = "block";
	}
}
//End Done By Usman For Browser Version Check


	

function hisProductRender()
{


	
	hisTop = getDynamicPositions("hisProductRender")["y"];
    hisLeft = getDynamicPositions("hisProductRender")["x"];
    removeElement("FavouriteProductDiv");
    var his = GetElement("HistoryProductDiv");
    his.style.top = hisTop + 20;
    his.style.left = hisLeft - 135;
    AjaxCall("HistoryProductDiv", "AJAX/HistoryResult.aspx", "");
    
}
	
	
	
	
	

function closeHistoryInner()
{
	if(historySessoin == "open")
	{
		historySessoin = "close";
	}
}
var historySessoin,oldtrseeionid,historyTd;
historySessoin = "close";
//var oldtrseeionid;
oldtrseeionid = null;
function historyInnerProducts(trSession,tdSession)
{
	if(oldtrseeionid != null)
	{
		document.getElementById(oldtrseeionid).style.display = 'none'
		//oldtrseeionid = null;
	}
	if(oldtrseeionid != tdSession)
	{
		oldtrseeionid = null;
	}
	if(historySessoin == "open") 
	{
		document.getElementById(tdSession).style.display = "none";
		imgchkHistory = 0;
		historySessoin = "close";
		//oldtrseeionid = null;
	//	pluschangeHistoryInner(imgchkHistoryId);
	}
	if ( (historySessoin == "close") && (oldtrseeionid != tdSession) && (imgchkHistory == 0) )
	{
		document.getElementById(tdSession).style.display = 'block';
		document.getElementById(tdSession).innerHTML = PreloaderIcons.BarIcon.Display();  //frameLoading;
		oldtrseeionid = tdSession;
		var req=null;
		req=initXMLHTTPRequest(); 
		if (req)
		{	
			req.open("POST","AJAX/HistoryInnerResult.aspx?prosess="+trSession,true);
			req.onreadystatechange=function()
			{
				var ready=req.readyState;
				if (ready==4)
				{
					xmlResult = req.responseText;
					document.getElementById(tdSession).innerHTML=xmlResult;
					historySessoin = "open";	
				}
				else
				{
				    document.getElementById(tdSession).innerHTML = PreloaderIcons.BarIcon.Display(); //frameLoading;
				}
			}
			req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
			req.send("");
			//imgchkHistory = 1;
		}
	}	
}
function pluschangeHistory(imID)
{
	if(imgchkHistory == 1)
	{
		//var img = document.getElementById(imgchkHistoryId);
		//img.src = catPlusPic;
		historySessoin = "close";
		imgchkHistory = 0;
		oldtrseeionid = null;
		if(imgchkHistoryId != imID)
		{	
		//	var img = document.getElementById(imID);
		//	img.src = catMinusPic;
			imgchkHistory = 0;
			imgchkHistoryId = imID;
			historySessoin = "close"
		}	
	}
	else
	{	
		//var img = document.getElementById(imID);
		//img.src = catMinusPic;
		imgchkHistory = 1;
		imgchkHistoryId = imID;
	}
}
var idHis;
idHis = null;
function historyPlusChng(imID)
{
	if(idHis == imID)
	{
		var imgOld = document.getElementById(idHis);
		imgOld.src = catPlusPic;
		//var img = document.getElementById(imID);
		//img.src = catPlusPic;
		idHis = null;
		oldtrseeionid = null;
	}
	else if(idHis != imID)
	{	
		var img = document.getElementById(imID);
		img.src = catMinusPic;
		if(idHis != null)
		{
			var imgOld = document.getElementById(idHis);
			imgOld.src = catPlusPic;
		}
		idHis = imID
	}
	/*if(idHis != imID)
	{
		idHis = imID
	}*/	
}
function HistoryrowProbkgdOver(CatRow)
{
	document.getElementById(CatRow).className = onMouseOverCatbkgd;
}

function HistoryrowProbkgdOut(CatRow)
{
		document.getElementById(CatRow).className = onMouseOutCatbkgd;
}
function HistoryrowTextOver(CatRow)
{
	//document.getElementById(CatRow).className = 'CatMouseHoverFontColor';
	document.getElementById(CatRow).className =  switchStringForIPhone('CatMouseHoverFontColor','CatMouseHoverFontColor_wap');
}

function HistoryrowTextOut(CatRow)
{
	//document.getElementById(CatRow).className = 'CatMouseOutFontColor'; 
	document.getElementById(CatRow).className = switchStringForIPhone('CatMouseOutFontColor','CatMouseOutFontColor_wap');
}
function pluschangeHistoryInner(imID)
{
	if(imgchkHistory == 1)
	{
		var img = document.getElementById(imgchkHistoryId);
		img.src = catPlusPic;
		//imgchkHistory = 2;
	}	
}
function hideHistoryRight()
{
	if(document.getElementById("HistoryProductDiv").style.display == "block")
	{
		document.getElementById("HistoryProductDiv").style.display= "none";
		document.getElementById("leftbartable").style.display= "block";
	}	
}
function viewDefaultCategories()
{
	document.getElementById("HistoryProductDiv").style.display= "none";
	if(document.getElementById('leftbartable').style.display == "none")
	{
		document.getElementById('leftbartable').style.display = "block";
	}
	if(document.getElementById('DIV_LIST').style.display == "none")
	{
		document.getElementById('DIV_LIST').style.display = "block";
	}
}
//  Function for Default Page ContactUs domain done by Usman 11.03.2008
function ContactInfo()
{
	//var C_Info = "\u00A9 " + document.domain + " | ";
	//document.getElementById("Contact_info").innerText = C_Info;

}
// End Function for Default Page ContactUs domain done by Usman 11.03.2008

/*-------------------------------------------------------
For: Full View of All Exsiting URLs assigned in flagAt[] 
20-03-08 - S.Zesshan*/

function fullViewWithURLs(){
	/**for(i=0; i<=addURLRef.length-1; i++)

	{
		if(window.location.host == addURLRef[i]){
			resizeInfiniViewWithResolution = true; 
		}
	}	
	**/
	var req=null;
	req=initXMLHTTPRequest();
	if (req)
	{
		req.open("POST","AJAX/CheckFullScreen.aspx",true);
		req.onreadystatechange=function()
		{
			var ready=req.readyState;
			var data=null;
			if (ready==4)
			{
			var Result = req.responseText ;
			Result = Result.replace(/^\s+|\s+$/g,"");
			if(Result.toLowerCase() == 'y')
				{
					resizeInfiniViewWithResolution = true; 
				}
				else
				{
					resizeInfiniViewWithResolution = false; 
				}
			}
		}
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		req.send("");
	}	
}
/* End Full View By URLS
-------------------------------------------------------*/
// End Web Tracker Call
//=======================================================================================================

/*---------------------------------------------------------------------------------*/
/*MODIFICATIONS: CATEGORY FIELS AND MAINIMAGE BY MULTIPLE RESOLUTION 
  MODIFIED: BY S.ZEESHAN 
  MODIFICATIONS DATE: 25-03-08 
---------------------------------------------------------------------------------*/
function CateFilesWithResoltuion(src)
{
	var splitSrc,fileName,newPattren,newCatURL,getResoluation;																
	getResoluation = ValidResoltuion() 
	// Check for MainImage if main image equal to url
	//if (src == mainPagePic)
	if((resizeInfiniViewWithResolution == true) && (src.match(".aspx")==null))
	{
		splitSrc = src.split("/");
		fileName = splitSrc[splitSrc.length-1];
		newPattren = getResoluation + "/" + fileName;
		newCatURL = src.replace(fileName,newPattren);
		return newCatURL;
	}

			
	// For Category Image By Multiple Resolution
	splitSrc = src.split("/");
	//fileName = splitSrc[this.length+1];
	fileName = splitSrc[splitSrc.length+1];
	newPattren = getResoluation + "/" + fileName;
	newCatURL = src.replace(fileName,newPattren);
	return newCatURL;
}
// Returns Screen Resoltion in Proper Patrren 
function ValidResoltuion()
{
    if (GetUAgentMainScript() != "") 
 {
     return "250x250";
 }
  else
  {
  	if(catComView.toLowerCase() == "topper")
  	{
  		return "855x475"; 
  	}
  	else
	{
		if ((screen.width<=1023) || (screen.height<=767)){ return "800x600";}
		else if((screen.width<=1279) || (screen.height<=1023)){ return "1024x768"; }
		else { return "1280x1024"; }
	}
  }
}
/*
End Category Files By Mutliple Resolution
---------------------------------------------------------------------------------*/

function GetQueryStringValue(_QueryString, _Key)
{
	var page = new PageQuery(_QueryString); 
	return unescape(page.getValue(_Key)); 
}

/* --------------------------------------------------------------------------------
MODIFICATINO: CREATE COOKIE FOR STORE CUSTOER JABBER ID 
LAST MODIFIED: DATE 01-04-08 
MODIFIED BY: S.ZEESHAN 
----------------------------------------------------------------------------------*/ 
function getJID(JID,operatorJID){
	createJabberCookie("InfiniCustomerJabberId",JID,7)
	createJabberCookie("InfiniCustomerOpreatorId",operatorJID,7)
	setCookie();
}
function createJabberCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
	
}
function readJabberCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

/* END -------------------------------------------------------------------------*/

//function for 3D Security done by Usman 17.04.2008 for full framesize
function Framesize_Security()
{

if(resizeInfiniViewWithResolution == false)
{
	var screen_height = screen.height;
	var screen_width = screen.width;
	if ((screen_width<=1023) || (screen_height<=767))
		{
			//document.getElementById("Search_Table").style.display = "none"; 
			document.getElementById("bottomtbl").style.display = "none"; 
			//bottomtbl
			FSIFrameSize(780,435);
			
		}
		else if((screen_width<=1279) || (screen_height<=1023))
		{
			//document.getElementById("Search_Table").style.display = "none"; 
			document.getElementById("bottomtbl").style.display = "none"; 
			FSIFrameSize(780,435);
		}

		else if ((screen_width>=1280) || (screen_height>=1024))
		{
			//document.getElementById("Search_Table").style.display = "none"; 
			document.getElementById("bottomtbl").style.display = "none";  
			FSIFrameSize(780,435);

		}
	}
}

//End function for 3D Security done by Usman 17.04.2008 for full framesize


//   START     ===================================   //
// Product querry URL
// Added by shahzeb 05 May 2008
//Modify By Usman 18.06.2008
function productQuerryURL(querryURL)
{

	//querryURL = "http://www.business4less.com?ProURL_ID=225844&View=NewWindow";
	if(querryURL != "noURL")
	{
		var Newquery = querryURL.split("?");
		for(u = 0; u < Newquery.length; u++)
		{
			var vars = Newquery[u].split("&"); 
				for (var i=0;i < vars.length;i++) 
					{ 
						var pair = vars[i].split("="); 
						if (pair[0].toLowerCase() == "view") 
						{ 
							productView(pair[1],querryURL);
						}
					} 
		}
	}

	/*
	var brkQuerry,alertTest;
	if(querryURL != "noURL")
	{
		brkQuerry = querryURL.split("=");
		var iChars = "&";
		var valQuerry = brkQuerry[1];
		alertTest = "noError";
		for (var i = 0; i < valQuerry.length; i++)
		{
			if (iChars.indexOf(valQuerry.charAt(i)) != -1) 
			{
				alertTest = "error"
  			}
		}
		if (alertTest != "error")
		{
			productView(valQuerry,brkQuerry[0]);
		}
		else if(alertTest == "error")
		{
			var breakQuerry;
			breakQuerry = valQuerry.split("&");
			productView(breakQuerry[0],brkQuerry[0]);
		}
	}*/
}
function productView(viewName,ViewURL)
{
	switch(viewName)
	{
		case "SameWindow":
			//var newURL;
			//newURL = ViewURL.split("?");
			//window.location.href = newURL[0];
			window.location.href = ViewURL;
			break;
		case "NewWindow":
			window.open(ViewURL,'','left=0,top=0,screenX=0,screenY=0,toolbar=yes,location=yes,status=yes,scrollbars=yes,resizable=yes');
			break;
		case "InfiniView":
			//parent.document.getElementById('frame_details').src = ViewURL;
			break;
		case "noURL":
			break;
	}
}
//   END     ===================================   //


//   START     ===================================   //
// Category and product mouseover enable disable
// Added by shahzeb 06 May 2008
function disableMouseOver()
{
	if(MouseOver_DisableEnable == "False")
	{
		MouseOver_DisableEnable = "True"
	}
	else if(MouseOver_DisableEnable == "True")
	{
		MouseOver_DisableEnable = "False"
	}
}
function ProductdisableMouseOver()
{
	if(MouseOver_DisableEnable == "False")
	{
		
	}
}
//   END     ===================================   //

//	MouseOver working
//	Start	SHAHZEB
//	07/03/2008

function SetSourceWithCommandsNew(src)
{
	if(MouseOver_DisableEnable == "True")
	{
	    if (GetUAgentMainScript() != "")
			{
			        src = src.replace("resolution", "250x250");
					window.frames["frame_details"].location.replace(src);
					fullScreenIframeSrc = src;
//					var the_height = document.getElementById('frame_details').contentWindow.document.body.scrollHeight;
//					document.getElementById('frame_details').height = the_height + "px";
			}
		else
			{
				if(USE_FILESYSTEM_PROUDCTCOMMANDS)
				{

					_screenWidthChkr =	screen.width;
					if(_screenWidthChkr >= 1280)
					{
						src = src.replace("resolution","1280x1024")
						window.frames["frame_details"].location.replace(src);
						fullScreenIframeSrc = src;
					}
					else if(_screenWidthChkr >= 1024 && _screenWidthChkr < 1280)
					{
						src = src.replace("resolution","1024x768")
						window.frames["frame_details"].location.replace(src);
						fullScreenIframeSrc = src;
					}
					else if(_screenWidthChkr >= 800 && _screenWidthChkr < 1024)
					{
						src = src.replace("resolution","800x600")
						window.frames["frame_details"].location.replace(src);
						fullScreenIframeSrc = src;
					}
				}
				else
				{
					window.frames["frame_details"].location.replace(src);
					return;
				}
		}
	}
}


function CategorySetSource(src)
{
	if(MouseOver_DisableEnable == "True")
	{	
		if(window.frames["frame_details"] != undefined)
		{
			window.frames["frame_details"].location.replace(src);
		}
	}
}

//	MouseOver working
//	End

// Fucntion for language Domains list done by Usman 05.05.2008

function Language_List() {
    if (select_lang) {
        window.location = select_lang.value;
    }
}
function SelectDefaultLanguage()
{
	if(document.getElementById('select_lang'))
	{
		var _Host = window.location.hostname;
		var s = select_lang.options.length;
		for(s ; s >= 1; s--)
		{
			var Val = select_lang.options[select_lang.options.length-s].value;
			var getHost = Val.split("/");
			for(var i=0; i <= getHost.length ; i++)
			{
				if(_Host == getHost[i])
				{
					select_lang.options[select_lang.options.length-s].selected=true;
				}
			}
		}
	}
}

// End Fucntion for language Domains list done by Usman 05.05.2008

function getview() 
{
	//GetiViewSource = window.frames["frame_details"].location.href;
	//CheckGetView = false;
}

function RestoregetView()
{
/*	if(CheckGetView == false)
	{
		window.frames["frame_details"].location.replace(GetiViewSource);
		CheckGetView = true;
	}*/
}
function EmptyGetview()
{
	//CheckGetView = true;
}

//////	20 May 2008
/// Function for chat
// Created by shahzeb


function chatroomImageShow()
{
	var req=null;
	req=initXMLHTTPRequest();
	if (req)
	{
		req.open("POST","Customer/CustomerChat.aspx",true);
		req.onreadystatechange=function()
		{
			var ready=req.readyState;
			var data=null;
			if (ready==4)
			{
				xmlResult = req.responseText;
				if(xmlResult != "notLogged In")
				{
					document.getElementById("customerchatting").innerHTML = xmlResult;
				}	
			}
			else
			{
				document.getElementById("customerchatting").innerHTML = "";
			}
		}
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		req.send("");
	}
}

function chatroom()
{
	//document.getElementById('IFConference').src = "";
	var req=null;
	var splitRslt,userId,userName,chatSiteURL;
	req=initXMLHTTPRequest();
	if (req)
	{
		req.open("POST","Customer/CustomerInfo.aspx",true);
		req.onreadystatechange=function()
		{
			var ready=req.readyState;
			var data=null;
			if (ready==4)
			{
				xmlResult = req.responseText;
				splitTslt = xmlResult.split(" ");
				userId = splitTslt[0];
				userName = splitTslt[1];
				//chatSiteURL = "http://live."+document.domain+"/chat/client_chat.php?customerNick="+userName+"&amp;customeruid="+userId;
				//document.getElementById('IFConference').src = chatSiteURL;
			}
			else
			{
				//document.getElementById("DIV_LIST").innerHTML=loadPagesImage;
			}
		}
		req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
		req.send("");
	}
	findPosY(document.getElementById("catBall"));
	findPosX(document.getElementById("catBall"));
	document.getElementById("leftbartable").style.display = "none";
	document.getElementById("showChatRoom_PHP").style.top = topCategory;
	document.getElementById("showChatRoom_PHP").style.left = leftCategory + 5;
	document.getElementById("showChatRoom_PHP").style.display = "block";
	SetObjectSize("IFChatroom", 220, 314);
	//EmptyGetview();
	//chatbox();
	//LoadSupport();
	SetObjectSize("IFConference", 536, 120);
	
	document.getElementById("sup").style.visibility = "hidden";
	document.getElementById("btd").style.display = "none";
	document.getElementById("cht").style.display = "none";
	document.getElementById("cht_PHP").style.display = "block";
	document.getElementById('IFChatroom').src = "http://live."+document.domain+"/chat/chatroom.php?customerNick="+userName+"&amp;customeruid="+userId;
}


// Cross Browser AJAX Gateway by Zeeshan.
// Dated: 09-06-08 
//---------------------------------------
function globalAjaxHttpObject(){
	var xmlRequest;
	try{  
		// Firefox, Opera 8.0+, Safari  
		xmlRequest=new XMLHttpRequest();  
		return xmlRequest; 	
			}
	catch (e){  
			// Internet Explorer  
			try	{    
				xmlRequest=new ActiveXObject("Msxml2.XMLHTTP");    
				return xmlRequest; 
				}
	catch (e){    
			try{      
				reqVar=new ActiveXObject("Microsoft.XMLHTTP");      
				return xmlRequest; 
				}
    catch (e){      
				alert("Your browser does not support AJAX!");      
				return false;      
				}
			}  
		}
}
// End Cross Browser AJAX Gateway 
//---------------------------------------



function ParseXMLResponse(request)
{
	if (BrowserDetect.browser == "Explorer" && BrowserDetect.version >= 4)
	{
		return request.responseXML.text;
	}
	else 
	{
		parser = new DOMParser();
		var xmlDoc = parser.parseFromString(request.responseText, "text/xml");
		return xmlDoc.firstChild.textContent;
	}
}


function isIE(){	
	if(navigator.appName == "Microsoft Internet Explorer"){
		return true;		
	}else{
		return false;
	}
}




//CROSS BROWSER XMLDOM LOADER
function XMLDOMObject(xmlStr)
{
	try 
	{
		//Internet Explorer
		xmlDoc=new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.async="false";
		xmlDoc.loadXML(xmlStr);
		return xmlDoc;
	}
	catch(e)
	{
	try 
		{
			//Firefox, Mozilla, Opera, etc.
			parser=new DOMParser();
			xmlDoc=parser.parseFromString(xmlStr,"text/xml");
			return xmlDoc;
		}
	catch(e) {alert(e.message)}
	}
}
	
	
function GetWizardControlsAsXMLDocument(xmlContent)
{
	//instantiate the W3C DOM Parser
	var parser = new DOMImplementation();

	//load the XML into the parser and get the DOMDocument
	var domDoc = parser.loadXML(xmlContent);

	//get the root node (in this case, it is ROOTNODE)
	var docRoot = domDoc.getDocumentElement();
	
	return docRoot;
	
}


function GetBrowserIndendentElementForDocument(_document, _element)
{
	if (_document.getElementById)
	{
		return _document.getElementById(_element);
	}
	else if (_document.getElementByName)
	{
		return _document.getElementByName(_element);
	}
	else if (_document.layers)
	{
		return _document.layers[_element];
	}
	else if (_document.all)
	{
		return _document.all[_element];
	}
}

function GetErrorMessage(ex)
{
	var ErrorMessage = ex.number + " " + ex.description + "\r\n" + ex.name + " " + ex.message;
	return ErrorMessage;
}

var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();


function SetImgWithResolution(src)
{
	if(window.frames["frame_details"] != undefined)
	{
		var catURLForFullView = CateFilesWithResoltuion(src)
		if (resizeInfiniViewWithResolution == true)
		{
			window.frames["frame_details"].location.replace(catURLForFullView);
		}
		else
		{
			window.frames["frame_details"].location.replace(src);
		}
	}

}

//---------------------------------------------------------------------------------------------------------
//Add By Kamran 

function PageBannerLoad_Main(screen,Banner,slot)
{
	var url = _Domain + "/MP_Ajax/MP_PageBanner.aspx?slot_name="+ slot +"&screen=" + screen + "&banner="+Banner;
	var xmlRequest = DoCallbackNew(url,"")
	if (xmlRequest)
			{ 
					if (Banner=='Banner_right')
					{
						document.getElementById("Banner_right").style.display = "block";
						PageAdRender_Main(xmlRequest.responseText,'Banner_right')
						
					}
					else if (Banner=='Banner_left')
					{
						document.getElementById("Banner_left").style.display = "block";
						PageAdRender_Main(xmlRequest.responseText,'Banner_left')
						
					}
					else if (Banner=='Banner_bottom')
					{
						document.getElementById("Banner_bottom").style.display = "block";
						PageAdRender_Main(xmlRequest.responseText,'Banner_bottom')
						
					}
			} 
			

}
var temp_right1 = new Array();
var temp_left1 = new Array();
var temp_bottom1 = new Array();

function PageAdRender_Main(res,banner)
{
					var str = res;
								
					if (banner=='Banner_right')
					{
						temp_right1 = str.split('&&');
						PageAd_Main();
						var ints1;
						ints=setInterval("PageAd_Main();",10000)
					}
					else if (banner=='Banner_left')
					{
						temp_left1 = str.split('&&');
						PageAdleft_Main();
						var ints2;
						ints=setInterval("PageAdleft_Main();",10000)
					}
					else if (banner=='Banner_bottom')
					{
						temp_bottom1 = str.split('&&');
						PageAdbottom_Main();
						var ints3;
						ints=setInterval("PageAdbottom_Main();",10000)
					}
			
}



var imp_count = 0
function PageAd_Main()
{ 
if (isFull==true)
	{
		
		removeElementById('Banner_right');
	}
	else
	{
	if (temp_right1[imp_count] != null)
			{
				if (temp_right1[imp_count]!= '')
				{
				
					document.getElementById("Banner_right").style.display = "block";
					document.getElementById("Banner_right").innerHTML=temp_right1[imp_count];
					imp_count=imp_count+1;
				}
				else
				{
					imp_count=0
				}
			}
		else
			{
				document.getElementById("Banner_right").style.display = "block";	
				imp_count=0
			}

	}
	
}


var imp_count1 = 0
function PageAdleft_Main()
{ 

	if (isFull==true)
	{
		
		removeElementById('Banner_left');
	}
	else
	{
	if (temp_left1[imp_count1] != null)
		{
			if (temp_left1[imp_count1]!= '')
			{
			
				document.getElementById("Banner_left").style.display = "block";
				document.getElementById("Banner_left").innerHTML=temp_left1[imp_count1];
				imp_count1=imp_count1+1;
			}
			else
			{
				imp_count1=0
			}
		}
	else
		{
			document.getElementById("Banner_left").style.display = "block";	
			imp_count1=0
		}
	}
}



var imp_count2 = 0
function PageAdbottom_Main()
{ 
	
	if (isFull==true)
	{
		
		removeElementById('Banner_bottom');
	}
	else
	{
	if (temp_bottom1[imp_count2] != null)
		{
			if (temp_bottom1[imp_count2]!= '')
			{
			
				document.getElementById("Banner_bottom").style.display = "block";
				document.getElementById("Banner_bottom").innerHTML=temp_bottom1[imp_count2];
				imp_count2=imp_count2+1;
			}
			else
			{
				imp_count2=0
			}
		}
	else
		{
			document.getElementById("Banner_bottom").style.display = "block";	
			imp_count2=0
		}
	}
}

// --------------------- END KAMRAN TASK -------------------------------

function ShowcaseShow()
{
	SetSource('../AJAX/ProductShowcase.aspx');
	downslideNew();
	hideAllRight();	
}

function PreviewCheck()
{
	if(PreviewControl == false)
		{
			PreviewControl = true;
			img_preview.setAttribute("alt", "Preview ON");
			document.getElementById('img_preview').src = '../images/PreviewHover.jpg';
		}
		else if(PreviewControl == true)
		{
				PreviewControl = false;
				img_preview.setAttribute("alt", "Preview OFF");
				document.getElementById('img_preview').src = '../images/PreviewSimple.jpg';
		}
}
function PreviewShow(Src,func)
{
	var ImagePreviewSet = 'false';
	var USettings = ReadCookie("usersettings");
	if (USettings != '')
	{
		var vars = USettings.split("&"); 
		for (var i=0;i<vars.length;i++) 
		{ 
			var pair = vars[i].split("="); 
			if (pair[0].toLowerCase() == "productimagepreview") 
				{ 
					ImagePreviewSet = pair[1]; 	
				}
		}
	}
	if(ImagePreviewSet.toLowerCase() == 'true' || catComView.toLowerCase() == "topper" )
	{
		if(func.toLowerCase() == 'sw')
		{
			
			SetSourceWithCommands(Src);
		}
		else if(func.toLowerCase() == 'ss')
		{
			SetSource(Src);
		}
	}
}

function RelatedPreviewShow(src)
{
	var RelatedPreviewSet = 'true';
	/**
		var USettings = ReadCookie("usersettings");
		if (USettings != '')
		{
			var vars = USettings.split("&"); 
			for (var i=0;i<vars.length;i++) 
			{ 
				var pair = vars[i].split("="); 
				if (pair[0].toLowerCase() == "relatedproductpreview") 
					{ 
						RelatedPreviewSet = pair[1]; 	
					}
			}
		}
	**/

	if (RelatedPreviewSet.toLowerCase() == 'true' )
	{	
	var screen_height = screen.height;
	var screen_width = screen.width;
	var IFrame = document.getElementById("iframeRelatedProShow");
	src = _Domain + src;
	
	if ((screen_width<=1023) || (screen_height<=767))
	{
		IFrame.width="545px"
		IFrame.height="230px"
	}
	else if((screen_width<=1279) || (screen_height<=1023))
	{
		if(resizeInfiniViewWithResolution == false)
			{
				IFrame.width="545px";
				IFrame.height="229px";
			}
			else
			{	
			IFrame.width="768px"
			IFrame.height="229px";
			}
	}
	else if ((screen_width>=1280) || (screen_height>=1024))
	{
		if(resizeInfiniViewWithResolution == false)
		{
			IFrame.width="545px";
			IFrame.height="229px"  
		}else
		{
			IFrame.width= "960px"; 
			IFrame.height= "477px";
		}
	}

	if(USE_FILESYSTEM_PROUDCTCOMMANDS)
	{
		_screenWidthChkr =	screen_width;
		if(_screenWidthChkr >= 1280)
		{
			src = src.replace("resolution","1280x1024")
			parent.window.frames["iframeRelatedProShow"].location.replace(src);
			
		}
		else if(_screenWidthChkr >= 1024 && _screenWidthChkr < 1280)
		{
			src = src.replace("resolution","1024x768")
			parent.window.frames["iframeRelatedProShow"].location.replace(src);
		}
		else if(_screenWidthChkr >= 800 && _screenWidthChkr < 1024)
		{
			src = src.replace("resolution","800x600")
			parent.window.frames["iframeRelatedProShow"].location.replace(src);
		}
	}
	else
	{
		window.frames["iframeRelatedProShow"].location.replace(src);
	}
	
	findPosY(document.getElementById("IFRAME_Table"));
	findPosX(document.getElementById("IFRAME_Table"));
	document.getElementById("RelatedProShow").style.top = topCategory;
	document.getElementById("RelatedProShow").style.left = leftCategory + 75;
	document.getElementById('RelatedProShow').style.width = IFrame.width;
	document.getElementById('RelatedProShow').style.height = IFrame.height;
	document.getElementById('RelatedProShow').style.display = "block";
	document.getElementById('RelatedPreviewBg').style.display = "block";
	document.getElementById('lang_list').style.display = "none";
	document.getElementById("Banner_left").style.visibility = 'hidden';
	document.getElementById("Banner_bottom").style.visibility = 'hidden';
	document.getElementById("Banner_right").style.visibility = 'hidden';
  }
}

function CloseRelatedPreview()
{
	document.getElementById('lang_list').style.display = "block";
	document.getElementById('RelatedProShow').style.display = "none";
	document.getElementById('RelatedPreviewBg').style.display = "none";
	//document.getElementById("Banner_left").style.visibility = 'visible';
	//document.getElementById("Banner_bottom").style.visibility = 'visible';
	//document.getElementById("Banner_right").style.visibility = 'visible';
	//parent.window.frames["iframeRelatedProShow"].src = "";
}

function rowProbkgdOverInText(CatRow)
{
	document.getElementById(CatRow).className = onMouseOverCatbkgd;
}

function rowProbkgdOutinText(CatRow)
{
	document.getElementById(CatRow).className = onMouseOutCatbkgd;
}

function BuyerButtonRedirect()
{
	var src = "http://" + window.location.host + "/Customer/home.aspx"; 
	SetSourceNew(src)
}
function cartProcessWait(ChkString)
{
	try
	{
	
		document.getElementById("ProcessChecout").style.display='block';
		document.getElementById("paymentProcess").style.display='none';
		if(ChkString == "ACheckout")
		{
			parent.window.ProcessCartCommandNew('ACheckout');
			//setTimeout("parent.NewPopupShow('../shopping/checkoutfinal.aspx')",400);
			//parent.NewPopupShow('../shopping/checkoutfinal.aspx')
		}
		if(ChkString == "ABCheckout")
		{
			parent.window.ProcessCartCommandNew('ABCheckout');
		}
		else if(ChkString == "GCheckout")
		{
				parent.window.ProcessCartCommandNew('GCheckout');
		}
		else if(ChkString == "WPCheckout")	
		{
				parent.window.ProcessCartCommandNew('WPCheckout');
		}
		else if(ChkString == "PECheckout")
		{
			parent.window.ProcessCartCommandNew('PECheckout');
			//CheckoutPayPalExpress();
		}
		else if(ChkString == "PCheckout")
		{
			parent.window.ProcessCartCommandNew('PCheckout');
		}
	}
	catch(e)
	{
		Checkout();
	}
}

function defaultPageBannerhome_init()
{
	//document.getElementById("loadingLayer").style.display = "none";
	//document.getElementById("Layer1").style.visibility = "visible";	

	var screen_height = screen.height;
	var screen_width = screen.width;
	var IFrame = document.getElementById("IO_Office_Container");
	var MainTable = document.getElementById("Page_Table");
	
	if ((screen_width<=1023) || (screen_height<=767)){
		IFrame.width="100%"
		IFrame.height="220"
	}
	else if((screen_width<=1279) || (screen_height<=1023))
	{
		if(resizeInfiniViewWithResolution == false){
				IFrame.width="780";
				IFrame.height="370";
			}else{	
				MainTable.width= fullPageWidth // Returns "972.8" on Resoluation 1024x768; 
				IFrame.width= "100%"; 
				IFrame.height= "360";
				IFrame.align="left";
			}


		document.getElementById("ag").style.verticalAlign = "middle";
	}
	else if ((screen_width>=1280) || (screen_height>=1024))
	{
		if(resizeInfiniViewWithResolution == false)
		{
			
			IFrame.width="780";
			IFrame.height= 370; 
		}else
		{	
			IFrame.width= "100%"; 
			IFrame.height= "100%";
			IFrame.align="left";
		}
		document.getElementById("ag").style.verticalAlign = "Top";

	}
			document.getElementById("Banner_right").innerHTML	= loadPagesImage;
			document.getElementById("Banner_left").innerHTML	= loadPagesImage;
			document.getElementById("Banner_bottom").innerHTML	= loadPagesImage;
			setTimeout("defaultPageBannerVisibleNew()",2000);
}



// ========= RELATED_PRODUCT_PREVIEW ====================//
// BY ZEESHAN 

function relatedProductPreview(rp_id)
{
	ProductSlideShow_Init(rp_id);
}

// ========= END RELATED_PRODUCT_PREVIEW ================//



// =========================================================================
//Done by Asher Syed on 04/11/2008

function LoadCommands_WorkflowProduct(productID, productCODE, sortNo, mandatory)
{
	
	
	var SubProductCount = _WorkflowProduct.GetWorkflowProductCount(productID, productCODE);
	if (parseInt(SubProductCount) > 0)
	{
		WORKFLOW_PARENT_PRODUCT[WORKFLOW_PARENT_PRODUCT.length] = productID;
		WORKFLOW_PRODUCT_CURRENT = productID;
		
		var seqUrl;
		seqUrl = PAGE_WORKFLOWPRODUCT + "?product_id=" + productID;
		SetSource(seqUrl);
	}
	else
	{
		ShowHideProductCommands('Product', productID, '?product_id=' + productID, null, 'search');		
	}
	
}

function GetContentAsXMLDocument(xmlContent)
{
	//instantiate the W3C DOM Parser
	var parser = new DOMImplementation();

	//load the XML into the parser and get the DOMDocument
	var domDoc = parser.loadXML(xmlContent);

	//get the root node (in this case, it is ROOTNODE)
	var docRoot = domDoc.getDocumentElement();
	
	return docRoot;
	
}

function Workflow_SkipProduct(ProductID)
{
	//var 
	_WorkflowProduct._NavigationCommands._MoveNext();
	
}

function Workflow_ClearContainer()
{
		var Container_Workflow = document.getElementById("Container_Workflow");
		if (Container_Workflow != null)
		{
			Container_Workflow.innerHTML = "";
			Container_Workflow.style.display = "none";
		}
}

//END DONE BY ASHER SYED 20081120
function Workflow_LoadNextProduct()
{

	//DONE BY ASHER SYED ON 20081120 FOR SHOWING NEXT PRODUCT IN WORKFLOW
	
	if (_CurrentWorkflowProduct != null)
	{
		
		if (_CurrentWorkflowProduct._Workflow != null)
		{
			if (_CurrentWorkflowProduct._CurrentProduct != null)
			{
				if (_CurrentWorkflowProduct._CurrentProduct._RedirectToCart == true)
					{
						Workflow_ClearContainer();
						_WorkflowProduct = null;
						_NavigationCommands = null;
						_CurrentWorkflowProduct = null;
						SetSource(PAGE_SHOPPINGCART + "?LoadCommands=0");
						return;
					}
				if (_CurrentWorkflowProduct._CurrentProduct._SortNo == _CurrentWorkflowProduct._Workflow._SubProducts.length)
				{
					
					if (_CurrentWorkflowProduct._ProductID == _WorkflowProduct._ProductID)
					{
						Workflow_ClearContainer();
						_WorkflowProduct = null;
						_NavigationCommands = null;
						_CurrentWorkflowProduct = null;
						SetSource(PAGE_SHOPPINGCART + "?LoadCommands=0");
					}
					else
					{
						
						var ProductID = _CurrentWorkflowProduct._ParentProductID;
						var ParentID = _CurrentWorkflowProduct._ParentProductID;
						var ParentCode = _CurrentWorkflowProduct._ParentProductCode;
						var SortNo = _CurrentWorkflowProduct._SortNo;
						
						var temp = PAGE_WORKFLOWPRODUCT + "?product_id=" + ProductID + "&ParentID=" + ParentID + "&ParentCode=" + ParentCode + "&SortNo=" + SortNo;
						SetSource(temp);
					}
					
					
				}
				
				else if(_CurrentWorkflowProduct._CurrentProduct._SortNo < _CurrentWorkflowProduct._Workflow._SubProducts.length)
				{
					//_CurrentWorkflowProduct.LoadCommands(_CurrentWorkflowProduct._Workflow._SubProducts[_CurrentWorkflowProduct._CurrentProduct._SortNo]._ProductID);
					var tempProduct = null;
					tempProduct = _CurrentWorkflowProduct._Workflow._SubProducts[_CurrentWorkflowProduct._CurrentProduct._SortNo];
					
					if (tempProduct == null)
					{
						
						var ProductID = _CurrentWorkflowProduct._ParentProductID;
						var ParentID = _CurrentWorkflowProduct._ParentProductID;
						var ParentCode = _CurrentWorkflowProduct._ParentProductCode;
						var SortNo = _CurrentWorkflowProduct._SortNo;
						
						var temp = PAGE_WORKFLOWPRODUCT + "?product_id=" + ProductID + "&ParentID=" + ParentID + "&ParentCode=" + ParentCode + "&SortNo=" + SortNo;
						SetSource(temp);
						
						return;
						
					}
					else
					{
						_CurrentWorkflowProduct._CurrentProduct.ChangeTo_Purchased();
						_CurrentWorkflowProduct._CurrentProduct = tempProduct;
						//_CurrentWorkflowProduct._LoadedProducts[_CurrentWorkflowProduct._LoadedProducts.length] = tempProduct;
						//_CurrentWorkflowProduct._CurrentProduct.ChangeTo_Current();
						//_CurrentWorkflowProduct._CurrentProduct.LoadCommands(tempProduct._ProductID);
						_CurrentWorkflowProduct._CurrentProduct.LoadCommands();
						//LoadCommands_WorkflowProduct(tempProduct._ProductID, tempProduct._ProductCode, tempProduct._SortNo, tempProduct._Mandatory);
					}
				}
			}
			else
			{
				Workflow_ClearContainer();
				_WorkflowProduct = null;
				_NavigationCommands = null;
				_CurrentWorkflowProduct = null;
				SetSource(PAGE_SHOPPINGCART + "?LoadCommands=0");
			}
		}
	}
	//END DONE BY ASHER SYED ON 20081120 FOR SHOWING NEXT PRODUCT IN WORKFLOW
}

// DONE BY ASHER SYED FOR REDIRECTING WORKFLOW PRODUCTS

function buyerTable()
{
	if(window.parent.frames.frame_details.buyerview != undefined)
	{
		window.parent.frames.frame_details.buyerview.style.display = "block";
		window.parent.frames.frame_details.loadingBuyer.style.display = "none";
	}	
	else
	{
		//buyerTable();
	}	
}
function seqProduct(pro_id)
{
	WORKFLOW_PARENT_PRODUCT[0] = pro_id.toString();
	_WorkflowProduct = null;
	_NavigationCommands = new NavigationCommands();
	_CurrentWorkflowProduct = null;
	var seqUrl;
	seqUrl = PAGE_WORKFLOWPRODUCT + "?product_id=" + pro_id;
	SetSource(seqUrl);
}

function buyerProcess(ProductIDBuyer)
{
	var seqUrl;
	seqUrl = "AJAX/BuyerProProcess.aspx?product_id=" + ProductID;
	SetSource(seqUrl);
}
function pBuyer(ProductIDBuyer)
{
	var seqUrl;
	window.parent.frames.frame_details.buyerview.style.display = "none";
	seqUrl = "BuyerProProcess.aspx?product_id=" + ProductIDBuyer;
	SetSource(seqUrl);
}
function redirecttoProduct(ProIDBuyer)
{
	var seqUrl;
	res = screen.width+"x"+screen.height;
	seqUrl = "BuyerBuyProduct.aspx?product_id=" + ProIDBuyer + "&set="+res;
	SetSource(seqUrl);
}
function proMainRedirect(proID)
{
	urlName = document.domain;
	var imgLoc = "http://" + urlName + '/default.aspx?ProURL_ID='+proID;
	this.parent.location.href = imgLoc;
}

function CheckWorkflowQueryString()
{
	
	var Workflow = queryString("Workflow");
	var Order = queryString("Order");
	var Code = queryString("Code");
	var Display = queryString("Display");
	
	if (Workflow != "false" && Order != "false" && Code != "false" && Display != "false")
	{
		if (parent.RedirectedToWorkflowOrder == null)
		{
			RedirectedToWorkflowOrder = true;
			var url = PAGE_WORKFLOWORDER + "?Workflow=" + Workflow + "&Order=" + Order + "&Code=" + Code + "&Display=" + Display
			SetSource(url);
			return true;
		}
	}
	else
	{ 
		return false;
	}
}


function hideWorkFlow()
{
/*
if(this.window.Container_Workflow.style.display == "block")
{
	this.window.Container_Workflow.style.display = "none";
}
*/
document.getElementById("Container_Workflow").style.display = "none";
_WorkflowProduct = null;
_CurrentWorkflowProduct = null;
_NavigationCommands = null;
WORKFLOW_PRODUCT = null
WORKFLOW_PRODUCT_MANDATORY = null
}

//Done By Asher Syed on 20090126 for readymade company
function ProcessCommand_ReadyMadeCompany_InfiniShops(arg)
{
	if (arg == "Check")
	{
		parent.ShowHideProductCommands('Product', parent.CurrentProductID, '?product_id=' + parent.CurrentProductID, null, 'search');
		parent.document.getElementById("RelatedProductDiv").style.display = 'none';
		return;
	}
	if (arg == "Buy")
	{
		window.top.frames["frame_details"].SetArgument(arg);
		window.top.frames["frame_details"].Submit();
		return;
	}	
}

function LoadCommands_ReadyMadeCompany_InfiniShops(arg)
{

	var xmlRequest;
	
	if (arg != null)
	{
		if (CurrentProductPrice == "0.00")
		{
			xmlRequest = DoCallback(_Domain + "/AJAX/Commands_ReadyMadeCompany_InfiniShops.aspx", "?product_id=" + CurrentProductID + "&WithProceed=true");
		}
		else
		{
			xmlRequest = DoCallback(_Domain + "/AJAX/Commands_ReadyMadeCompany_InfiniShops.aspx", "?product_id=" + CurrentProductID + "&price=" + CurrentProductPrice + "&WithProceed=true");
		}
	}
	else
	{
		if (CurrentProductPrice == "0.00")
		{
			xmlRequest = DoCallback(_Domain + "/AJAX/Commands_ReadyMadeCompany_InfiniShops.aspx", "?product_id=" + CurrentProductID);
		}
		else
		{
			xmlRequest = DoCallback(_Domain + "/AJAX/Commands_ReadyMadeCompany_InfiniShops.aspx", "?product_id=" + CurrentProductID + "&price=" + CurrentProductPrice);
		}
	}
	
	document.getElementById("ACTIVECOMMANDS").innerHTML = xmlRequest.responseText;
	document.getElementById("ACTIVECOMMANDS").style.visibility = 'visible';
	
}

function GetPageName()
{
	var sPath = window.location.pathname;
	//var sPage = sPath.substring(sPath.lastIndexOf('\\') + 1);
	//var sPage = sPath.substring(sPath.lastIndexOf('/') + 1);
	return sPath;	
}
function CheckMultiReg()
{
			var domain = 'http://' +  window.location.host ;
			var query_new = window.location.search.substring(1); 
			var vars = query_new.split("&"); 
			for (var i=0;i<vars.length;i++) 
			{ 
				var pair = vars[i].split("="); 
				if (pair[0].toLowerCase() == "redirectto") 
				{ 
					domain = '/customer/CheckAllowMultiReg.aspx?RedirectTo=' + pair[1];
				}
				else
				{
					domain = '/customer/CheckAllowMultiReg.aspx';
				}
			}
			parent.SetSource(domain);
}
function MultiReg(ClickType)
{
			var domain = 'http://' +  window.location.host ;
			if(ClickType.toLowerCase() == 'simple')
			{
				domain = domain + '/customer/Register.aspx';
			}
			else if(ClickType.toLowerCase() == 'verified')
			{
				domain = domain + '/customer/Register.aspx?type=verified&RedirectTo=/Shopping/Checkout.aspx';
			}
			else if(ClickType.toLowerCase() == 'upgrade')
			{
				domain = domain + '/customer/Sign_In_Upgrade.aspx?type=upgrade&RedirectTo=/Shopping/Checkout.aspx'
			}
			//parent.SetSource(domain);
			window.location = domain;

			
}
function productCatLedder(proId)
{
	document.getElementById("stackText").innerHTML = loadPagesImage;
	var xmlRequest = DoCallback("../Catalog/ProductCatLadder.aspx?ProductId="+proId, "");
	xmlRes = xmlRequest.responseText;
	document.getElementById("stackText").innerHTML = xmlRes;
	stop();	
	//For Product Attribute
	//renderProductAttibute(mp_catid);
}
function CategoryLedder(CatId)
{
	document.getElementById("stackText").innerHTML = loadPagesImage;
	var xmlRequest = DoCallback("../Catalog/CatLeader.aspx?categoryID="+CatId, "");
	xmlRes = xmlRequest.responseText;
	document.getElementById("stackText").innerHTML = xmlRes;
	stop();	
	//For Product Attribute
	//renderProductAttibute(mp_catid);
}
function ProcessCommand_ReadyMadeDomain_InfiniShops(arg)
{
	if (arg == "Check")
	{
		parent.ShowHideProductCommands('Product', parent.CurrentProductID, '?product_id=' + parent.CurrentProductID, null, 'search');
		parent.document.getElementById("RelatedProductDiv").style.display = 'none';
		return;
	}
	if (arg == "Buy")
	{
		window.top.frames["frame_details"].SetArgument(arg);
		window.top.frames["frame_details"].Submit();
		return;
	}	
}


function LoadCommands_ReadyMadeDomain_InfiniShops(arg)
{

	var xmlRequest;
	
	if (arg != null)
	{
		if (CurrentProductPrice == "0.00")
		{
			xmlRequest = DoCallback(_Domain + "/AJAX/Commands_ReadyMadeDomain_InfiniShops.aspx", "?product_id=" + CurrentProductID + "&WithProceed=true");
		}
		else
		{
			xmlRequest = DoCallback(_Domain + "/AJAX/Commands_ReadyMadeDomain_InfiniShops.aspx", "?product_id=" + CurrentProductID + "&price=" + CurrentProductPrice + "&WithProceed=true");
		}
	}
	else
	{
		if (CurrentProductPrice == "0.00")
		{
			xmlRequest = DoCallback(_Domain + "/AJAX/Commands_ReadyMadeDomain_InfiniShops.aspx", "?product_id=" + CurrentProductID);
		}
		else
		{
			xmlRequest = DoCallback(_Domain + "/AJAX/Commands_ReadyMadeDomain_InfiniShops.aspx", "?product_id=" + CurrentProductID + "&price=" + CurrentProductPrice);
		}
	}
	
	document.getElementById("ACTIVECOMMANDS").innerHTML = xmlRequest.responseText;
	document.getElementById("ACTIVECOMMANDS").style.visibility = 'visible';
	
}

function ReadyMadeCompany_ShowBuyButton(sender)
{
	
	try
	{
	
		document.getElementById('img_buy').style.visibility = 'visible';
		
		/*
		
		var CurrentCompany = sender.id.split("_")[1].toString();
		
		var selected_company_number = sender.value;
		var selected_company_name = window.top.frames["frame_details"].document.getElementById('CompanyName_' + CurrentCompany).innerHTML;
		var selected_incorporation_date = window.top.frames["frame_details"].document.getElementById('IncorporationDate_' + CurrentCompany).innerHTML;
		
		var company_number = GetBrowserIndendentElementForDocument(window.top.frames["frame_details"].document, "company_number");
		company_number.value = selected_company_number;
		
		var company_name = GetBrowserIndendentElementForDocument(window.top.frames["frame_details"].document, "company_name");
		company_name.value = selected_company_name;
		
		var incorporation_date = GetBrowserIndendentElementForDocument(window.top.frames["frame_details"].document, "incorporation_date");
		incorporation_date.value = selected_incorporation_date;
		
		*/
	
	}
	catch(e)
	{
		alert(e.message);
	}
	
}

function ReadyMadeDomain_ShowBuyButton(sender)
{
	try
	{
	
		document.getElementById('img_buy').style.visibility = 'visible';
		
		/*
		var CurrentCompany = sender.id.split("_")[0].toString();
		
		var selected_domain_name = window.top.frames["frame_details"].document.getElementById('lblDomainName_' + CurrentCompany).innerHTML;
		var selected_registration_date = window.top.frames["frame_details"].document.getElementById('lblRegistrationDate_' + CurrentCompany).innerHTML;
		var selected_expiry_date = window.top.frames["frame_details"].document.getElementById('lblExpiryDate_' + CurrentCompany).innerHTML;
		var selected_price = window.top.frames["frame_details"].document.getElementById('lblPrice_' + CurrentCompany).innerHTML;
		
		var domain_name = GetBrowserIndendentElementForDocument(window.top.frames["frame_details"].document, "domain_name");
		domain_name.value = selected_domain_name;
		
		var registration_date = GetBrowserIndendentElementForDocument(window.top.frames["frame_details"].document, "registration_date");
		registration_date.value = selected_registration_date;

		var expiry_date = GetBrowserIndendentElementForDocument(window.top.frames["frame_details"].document, "expiry_date");
		expiry_date.value = selected_expiry_date;
		
		var price = GetBrowserIndendentElementForDocument(window.top.frames["frame_details"].document, "price");
		price.value = price;
		*/
	
	}
	catch(e)
	{
		alert(e.message);
	}

}

function ProcessCartCommandNew(arg)
{
	
	//window.top.frames["frame_details"].SetArgument(arg);
	//window.top.frames["frame_details"].Submit();
	if(window.top.frames["frame_details"])
	{
		window.top.frames["frame_details"].SetArgument(arg);
		window.top.frames["frame_details"].Submit();
	}
	else
	{
		window.frames["frame_details"].SetArgument(arg);
		window.frames["frame_details"].Submit();	
	}
		
	if (arg == "get_equote")
	{
		UnLoadCommands();
	}
	if (arg == "checkout")
	{
		Workflow_ClearContainer();
		UnLoadCommands();
	}
	if (arg == "continue_shop")
	{
	
		//LoadCartCommands();
		UnLoadCommands();
	}	
	
	if (arg == "google_checkout")
	{
		UnLoadCartCommands();
	}

}

//Added for Custom Validations for Domain Existence
//Will be called from InfiniView documents
//Will Validate for Existing Domains
//isDomainAvailable 
//True for existing domains
//False for non-exiting domains
function CheckDomainExistence(DomainName)
{
	//debugger;
	var url = "http://" + window.location.host + "/Utility.asmx";
	_Common = new Common();
	var request = _Common.RemoteCallWebService(url, "business4less.com", "CheckDomainExistence", "<DomainName>" + DomainName.toString() + "</DomainName>");
	try
	{
		if (request) 
		{ 
			//debugger;
			//request.onreadystatechange = function() {}
			var sr = _Common.GetSOAPMethodCall("business4less.com", "CheckDomainExistence", "<DomainName>" + DomainName.toString() + "</DomainName>");
			request.send(sr);
			if( request.readyState == 4 )
			{
				var result = ParseXMLResponse(request);
				if (result == "FALSE")
				{
					return false;
				}
				if (result == "TRUE")
				{
					return true;
				}
				if (result == "UNDEFINED")
				{
					return false;
				}
			}
		}
	}
	catch(exp)
	{
		window.alert(exp.toString());			
	}
}


/*** IPHONE DEVELOPMENT MADE BY ZEESHAN ON 07 APRIL 009 **/
//*******************************************************/

function iPhoneInifiniView(iViewVisibility, mainCategoryVisibility )
{
	var elems = ["FavouriteProductDiv","HistoryProductDiv"]
	for(var i =0;i<elems.length;i++)
	{
		if(document.getElementById(elems[i]) != null)
		{
			document.getElementById(elems[i]).style.display = "none";
		}	
	}
	var infiniViewTable = document.getElementById("IFrameTD");
	var infiniViewFrame = document.getElementById("frame_details");
	var mainCategories = document.getElementById("leftbartable");
	document.getElementById("catBall").style.display = mainCategoryVisibility;
	document.getElementById("actCmd_Container").style.display = iViewVisibility;
	mainCategories.style.display = mainCategoryVisibility;
	infiniViewTable.style.display = iViewVisibility;
	infiniViewFrame.style.display = iViewVisibility;
}
/**
var isIPhone = navigator.userAgent.indexOf('iPhone');

if (navigator.userAgent.indexOf('MSIEMobile') != -1) {
    isIPhone = navigator.userAgent.indexOf('MSIEMobile');
}**/
var isIPhone = GetUAgentMainScript(); 



function isIPhoneBrowser()
{
	if(navigator.userAgent.indexOf('iPhone')!= -1)
	{
		return true;
	}
	else
	{
		return false;
	}
}

function getDynamicTransform(funcName,dw,dh)
{
	var sizeOf = new Array();
	switch(funcName)
	{
	//------------------------------------------------------
		case "slidebox" :
		
			 if (GetUAgentMainScript() != "")
			{ 
				sizeOf["width"]		=	"100%";
				sizeOf["height"]	=	"302";
			}
			else
			{ 
				sizeOf["width"]		=	"220";
				sizeOf["height"]	=	"302";
			}
			return sizeOf; 
		break;
	//-----------------------------------------------------
	//------------------------------------------------------
		case "SetObjectSize" :
			
			if (GetUserAgent() != "") 
			{
				sizeOf["width"]		=	"100%";
				sizeOf["height"]	=	"302";
			}
			else
			{ 
				sizeOf["width"]		=	dw;
				sizeOf["height"]	=	dh;
			}
			return sizeOf; 
		break;
	//-----------------------------------------------------
	//-----------------------------------------------------
		case "CatLoadCaller" :

		    if (GetUserAgent() != "") 
			{
				sizeOf["width"]		=	(document.body.clientWidth * .9); //"100%";
				sizeOf["height"]	=	"100%";
			}
			else
			{ 
				sizeOf["width"]		=	dw;
				sizeOf["height"]	=	dh;
			}
			return sizeOf; 
		break;
	//-----------------------------------------------------
	}
}
function getDynamicPositions(funcName,dpX,dpY)
{
	var posOf = new Array();
	switch(funcName)
	{
	//------------------------------------------------------
	    case "hisProductRender":
	        if (GetUserAgent() != "") 
			{ 
				posOf["x"]		=	0;
				posOf["y"]		=	30;
			}
			else
			{ 
				/*if(catComView.toLowerCase() == "topper")
				{
					posOf["x"]		=	findPosX(document.getElementById("catBallNew"));
					posOf["y"]		=	findPosY(document.getElementById("catBallNew"));
				}
				else
				{*/	
					posOf["x"]		=	findPosX(document.getElementById("catBall"));
					posOf["y"]		=	findPosY(document.getElementById("catBall"));
				/*}*/	
			}
			return posOf; 
		break;
		case "myMainCategoryMoving" :
		    if (GetUserAgent() != "")
			{ 
				posOf["x"]		=	"";
				posOf["y"]		=	60;
			}
			else
			{ 
				posOf["x"]		=	dpX;
				posOf["y"]		=	dpY;
			}
			return posOf; 
		break;
		case "RelatedProductDiv" :
		    if (GetUserAgent() != "")
			{ 
				posOf["x"]		=	0;
				posOf["y"]		=	30;
			}
			else
			{ 
				if(catComView.toLowerCase() == "topper")
				{
					posOf["x"]		=	findPosX(document.getElementById("catBallNew"));
					posOf["y"]		=	findPosY(document.getElementById("catBallNew"));
				}
				else
				{	
					posOf["x"]		=	findPosX(document.getElementById("catBall"));
					posOf["y"]		=	findPosY(document.getElementById("catBall"));
				}
			}
			return posOf; 
		break;
	//-------------------------------------------------------
	}
}
function iphoneOpenClosePannel(imgID,newSrc,reverseSrc,Elem)
{
	imgObj	=	document.getElementById(imgID);
	obj		=	document.getElementById(Elem);
	if(obj.style.display != "block")
	{ 
		imgObj.src = newSrc;
		obj.style.display = "block"; 
	}
	else { 
		imgObj.src = reverseSrc;
		obj.style.display = "none";
		}
}
function getIPhoneIViewFor(funcName) {
    switch(funcName)
    {
    case "SetSourceWithCommands"	:  if (GetUAgentMainScript() != "") {iPhoneInifiniView("block","none" ) ; } break;	
    case "ShowHideProductCommands"	:  if (GetUAgentMainScript() != "") {iPhoneInifiniView("block","none" ) ; }	break;
    case "refresh"					:  if (GetUAgentMainScript() != "") {iPhoneInifiniView("none" ,"block") ; }	break;
    case "LoadProductImageFiles"	:  if (GetUAgentMainScript() != "") {iPhoneInifiniView("block","none" ) ; }	break;
    case "loadChildLevels"			:  if (GetUAgentMainScript() != "") {iPhoneInifiniView("none" ,"block") ; }	break;
    case "myaccount"				:  if (GetUAgentMainScript() != "") {iPhoneInifiniView("block","none" ) ; }	break;
    case "stackCat"					:  if (GetUAgentMainScript() != "") {iPhoneInifiniView("none","block" ) ; }	break;
    case "SetSourceNewWithCommands" :  if (GetUAgentMainScript() != "") {iPhoneInifiniView("block" ,"none" ) ; }break;
    case "SetSourceNew"				:  if (GetUAgentMainScript() != "") {iPhoneInifiniView("block" ,"none" ) ; }break;
    case "CalculateAmount_WizardProduct" : if (GetUAgentMainScript() != "") {iPhoneInifiniView("block" ,"none" ) ; }	break;		
    }
}

function switchStringForIPhone(css, wapCss) {
    if (GetUAgentMainScript() != "") {
        return wapCss;
    }
    else {
        return css;
    }

}

function switchRedirection(URL, wapURL) {
    if (GetUAgentMainScript() != "") {

        parent.location = wapURL;
    }
    else {
        parent.location = URL;
    }

}




function __initIPHONE()
{
	if(document.getElementById("RelatedProductDiv"))
	{
		document.getElementById("RelatedProductDiv").style.top	=	getDynamicPositions("RelatedProductDiv",(topCategory + 10),(topCategory + 10))["y"]; //topCategory + 10;
		document.getElementById("RelatedProductDiv").style.left	=	getDynamicPositions("RelatedProductDiv",(topCategory + 10),(topCategory + 5))["x"] //leftCategory + 5;
	}
}

//__initIPHONE();
/* END IPHONE DEVELPMENT *****************************************************************/
/****************************************************************************************/

//Added for Custom Validations for Referrer Domain
//Will be called from InfiniView documents
//Will Validate for Existing Domains And previously un-registered Referrer Domain
//isDomainAvailable 
//True for existing domains
//False for non-exiting domains
function CheckReferrerDomain(DomainName)
{
	//debugger;
	var url = "http://" + window.location.host + "/Utility.asmx";
	_Common = new Common();
	var request = _Common.RemoteCallWebService(url, "business4less.com", "CheckReferrerDomain", "<DomainName>" + DomainName.toString() + "</DomainName>");
	try
	{
		if (request) 
		{ 
			//debugger;
			//request.onreadystatechange = function() {}
			var sr = _Common.GetSOAPMethodCall("business4less.com", "CheckReferrerDomain", "<DomainName>" + DomainName.toString() + "</DomainName>");
			request.send(sr);
			if( request.readyState == 4 )
			{
				//debugger;
				var result = ParseXMLResponse(request);
				result = result.toUpperCase();
				
				if (result == "FALSE")
				{
					return false;
				}
				if (result == "TRUE")
				{
					return true;
				}
				
			}
		}
	}
	catch(exp)
	{
		window.alert(exp.toString());			
	}
}

//Added for Custom Validations for UK Company Name Search
//Will be called from InfiniView documents
//Will Validate for Non-Existing Companies And previously un-registered Company Names
//searchCompanyName 
//True for existing Companies
//False for non-exiting Companies
function CheckUKCompanyName(CompanyName)
{
	//debugger;
	var url = "http://" + window.location.host + "/Utility.asmx";
	_Common = new Common();
	var request = _Common.RemoteCallWebService(url, "business4less.com", "CheckCompanyExistence", "<CompanyName>" + CompanyName.toString() + "</CompanyName>");
	try
	{
		if (request) 
		{ 
			//debugger;
			//request.onreadystatechange = function() {}
			var sr = _Common.GetSOAPMethodCall("business4less.com", "CheckCompanyExistence", "<CompanyName>" + CompanyName.toString() + "</CompanyName>");
			request.send(sr);
			if( request.readyState == 4 )
			{
				//debugger;
				var result = ParseXMLResponse(request);
				//result = result.toUpperCase();
				return result;
				
				/*
				if (result == "FALSE")
				{
					return false;
				}
				if (result == "TRUE")
				{
					return true;
				}
				*/
				
			}
		}
	}
	catch(exp)
	{
		window.alert(exp.toString());			
	}
} 

//Added for Custom Validations for Offshore Company Name Search
//Will be called from InfiniView documents
//Will Validate for Non-Existing Companies And previously un-registered Company Names
//searchCompanyName 
//True for existing Companies
//False for non-exiting Companies
function CheckOffshoreCompanyName(CompanyName, CompanyType, ProudctID)
{
	//debugger;
	var url = "http://" + window.location.host + "/Utility.asmx";
	_Common = new Common();
	var request = _Common.RemoteCallWebService(url, "business4less.com", "CheckOffshoreCompanyExistence", "<CompanyName>" + CompanyName.toString() + "</CompanyName>" + "<CompanyType>" + CompanyType.toString() + "</CompanyType>" + "<ProudctID>" + ProudctID.toString() + "</ProudctID>");
	try
	{
		if (request) 
		{ 
			//debugger;
			//request.onreadystatechange = function() {}
			var sr = _Common.GetSOAPMethodCall("business4less.com", "CheckOffshoreCompanyExistence", "<CompanyName>" + CompanyName.toString() + "</CompanyName>" + "<CompanyType>" + CompanyType.toString() + "</CompanyType>" + "<ProudctID>" + ProudctID.toString() + "</ProudctID>");
			request.send(sr);
			if( request.readyState == 4 )
			{
				//debugger;
				var result = ParseXMLResponse(request);
				//result = result.toUpperCase();
				return result;
				
				/*
				if (result == "FALSE")
				{
					return false;
				}
				if (result == "TRUE")
				{
					return true;
				}
				*/
				
			}
		}
	}
	catch(exp)
	{
		window.alert(exp.toString());			
	}
} 

//****************** IPHONE DEVELOPMENT BY ZEESAHAN - SLIDE MENU *******************************//

function iphoneSliderMenu_nextSlide(id, type, params, _URL, level) {
    var UAgent = GetUAgentMainScript();
    switch (level) {
        case "1":
            //t1 = new Tween(document.getElementById(id).style,'left',Tween.backEaseOut,0,-290,.8,'px')
            //t1.start();
//            if (GetUAgentMainScript() == "iPhone" || GetUAgentMainScript() == "android") {
//                LoadChildren1_wap(type, params, _URL);
//            } else if (GetUAgentMainScript() == "MSIE") {
//            //LoadChildren1_WinCE(type, params, _URL);
//            LoadChildren1_wap(type, params, _URL);
//            }
            // $("#DIV_LIST:hidden").removeAttr('style').hide().fadeIn();
            // $("#DIV_LIST").effect('slide', '', 700, '');
            LoadChildren1_wap(type, params, _URL);


            break;
        case "2":
            //document.getElementById("div_list_lvl2").style.visibility = 'visible';
            //t1 = new Tween(document.getElementById(id).style,'left',Tween.backEaseOut,-290,-580,.8,'px')
            //t1.start();
            ShowHideInnerLayoutNew_wap(params, _URL);
            // $("#DIV_LIST:hidden").removeAttr('style').hide().fadeIn();
            // $("#DIV_LIST").effect('slide', '', 700, '');
    }
    /*
    t1.onMotionFinished = function()
    {
    switch(level)
    {
    case "1" :
    //	document.getElementById('div_list_dyn').style.visibility = 'visible';
    //	document.getElementById('mainCat').style.visibility = 'hidden';
    break;
    case "2" :
    //document.getElementById('div_list_dyn').style.visibility = 'hidden';
    break;
			
    }

	}
    */
}


function iphoneSliderMenu_prevSlide(id, type, params, _URL, level) {

    switch (level) {
        case "1":
            //t1 = new Tween(document.getElementById(id).style,'left',Tween.backEaseOut,-290,10,.8,'px')
            //t1.start();
//            if (GetUAgentMainScript() == "iPhone" || GetUAgentMainScript() == "android") {
//                LoadChildren1_wap(type, params, _URL);
//            } else if (GetUAgentMainScript() == "MSIE") {
//            //LoadChildren1_WinCE(type, params, _URL);
//            LoadChildren1_wap(type, params, _URL);
//            }

            // $("#DIV_LIST:hidden").removeAttr('style').hide().fadeIn();
            // $("#DIV_LIST").effect('slide', '', 700, '');
            LoadChildren1_wap(type, params, _URL);
            break;
        case "2":
            //	document.getElementById('div_list_dyn').style.visibility = 'visible';
            //	t1 = new Tween(document.getElementById(id).style,'left',Tween.backEaseOut,-580,-290,.8,'px')
            //	t1.start();
            ShowHideInnerLayoutNew_wap(params, _URL);
            break;

        case "root":
            //document.getElementById('mainCat').style.visibility = 'visible';
            //	t1 = new Tween(document.getElementById(id).style,'left',Tween.backEaseOut,-290,0,.8,'px')
            //	t1.start();
            break;
    }
    /*
    t1.onMotionFinished = function()
    {
    switch(level)
    {
    case "root" :
    //	document.getElementById("stackText").innerHTML = "";
    //	document.getElementById('mainCat').style.visibility = 'visible';
    break;
    case "1" :
    //	document.getElementById('mainCat').style.visibility = 'visible';
    //	document.getElementById('div_list_lvl2').style.visibility = 'visible';
    break;
    case "2" :
    //	document.getElementById('div_list_lvl2').style.visibility = 'hidden';
    break;
    }
    }
    */
}
 
function LoadChildren1_wap(type, params, _URL)
{
//	myMainCategoryMoving();
    //hideWorkFlow();
    if (GetUAgentMainScript() != "") {
        xType = type;
        xParams = params;
        x_Url = _URL;
        document.getElementById('DIV_LIST').style.display = 'block';
        document.getElementById('DIV_LIST').innerHTML = loadPagesImage;
        //	document.getElementById('DIV_LIST').style.height = 260;
        if ((_URL != "") && (_URL != "javascript:")) {
            document.getElementById("DIV_LIST").innerHTML = redirectURL;
            window.location.href = _URL;
        }
        else if (_URL == "javascript:") {
            document.getElementById("DIV_LIST").style.display = 'block';
            //document.getElementById("leftbartable").style.top = topCategory;
            //document.getElementById("leftbartable").style.left = leftCategory;
            sldbox = 2;
            var xmlResult;
            var req = null;
            req = initXMLHTTPRequest();
            if (req) {
                //req.open("POST","Catalog/NewProPageDis.aspx"+params+ "&relatedpro="+RelatedViewChkr,true);
                req.open("GET", "Catalog/NewProPageDis.aspx" + params + "&relatedpro=" + RelatedViewChkr + uAgent, true);
                req.onreadystatechange = function() {
                    var ready = req.readyState;
                    var data = null;
                    if (ready == 4) {
                        xmlResult = req.responseText;
                        document.getElementById('DIV_LIST').innerHTML = "";
                        document.getElementById('DIV_LIST').innerHTML = xmlResult;
                        if (GetUAgentMainScript() == "msie") {
                            var the_height = document.body.clientHeight;
                            //var the_height = document.getElementById('DIV_LIST').contentWindow.document.body.offsetHeight;
                            //change the height of the iframe
                            document.getElementById('leftbartable').style.height = the_height;
                            document.getElementById('DIV_LIST').style.height = "100%";
                        }
                        if (navigator.userAgent.indexOf('MSIEMobile') == -1) {

                            // $("#DIV_LIST:hidden").removeAttr('style').hide().fadeIn();
                            //  $("#DIV_LIST").effect('slide', '', 700, '');
                        }
                        //$("#content").overscroll();
                        //document.getElementById("leftbartable").style.visibility = "visible";
                        secCatRes = xmlResult;
                        //SetObjectSize("DIV_LIST", 220, 314);
                        //initArrow('content');	
                        simpleTopVar = "showPro";
                        var firstProduct;
                        var i = params.indexOf('y')
                        i = i + 2
                        var d = params.indexOf('&', i);
                        var curr = d - i;
                        firstProduct = params.substr(i, curr);
                        var _fileURL;
//                        if (resizeInfiniViewWithResolution == true) {
//                            _fileURL = "http://" + window.location.host + '/cat_files/' + firstProduct + '/cat_img/resolution/index.htm';
//                            //SetSourceWithCommands(_fileURL);
//                            currentCenterImage = _fileURL;
//                        }
//                        else {
//                            _fileURL = "http://" + window.location.host + '/cat_files/' + firstProduct + '/cat_img/index.htm';
//                            //SetSource(_fileURL);
//                            currentCenterImage = _fileURL;
//                        }
                        catloadChecker = "Done";
                        //checkMainInterFace();
                        //myMainCategoryMoving();
                    }
                    else {
                    }
                }
                //req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
                req.send("");
            }
        }
    }
}



function ShowHideInnerLayoutNew_wap(params,_URL) {
    if (GetUAgentMainScript() != "") {
        if ((_URL != "") && (_URL != "javascript:")) {
            //document.getElementById("DIV_LIST").innerHTML = redirectURL;
            document.getElementById("DIV_LIST").style.display = 'block';
            document.getElementById("DIV_LIST").innerHTML = redirectURL;
            window.location.href = _URL;
       }
        else if (_URL == "javascript:") {
            document.getElementById("DIV_LIST").style.display = 'block';
            //document.getElementById("leftbartable").style.top = topCategory;
            //document.getElementById("leftbartable").style.left = leftCategory;
            sldbox = 2;
            var xmlResult;

            document.getElementById("DIV_LIST").innerHTML = loadPagesImage;


            //document.getElementById("DIV_LIST").innerHTML = loadPagesImage;
            var req = null;
            req = initXMLHTTPRequest();
            if (req) {
                //req.open("POST","Catalog/New_PreInner_CatPro.aspx"+params,true);
                req.open("GET", "Catalog/New_PreInner_CatPro.aspx" + params + uAgent, true);
                req.onreadystatechange = function() {
                    var ready = req.readyState;
                    var data = null;
                    if (ready == 4) {
                        xmlResult = req.responseText;
                        document.getElementById("DIV_LIST").innerHTML = "";
                        document.getElementById("DIV_LIST").innerHTML = xmlResult;
                       // $("#DIV_LIST:hidden").removeAttr('style').hide().fadeIn();
                      //  $("#DIV_LIST").effect('slide', '', 700, '');
                        //					$("#content").overscroll();
                        //document.getElementById("DIV_LIST").innerHTML=xmlResult;
                        //SetObjectSize("DIV_LIST", 220, 350);
                        //initArrow('content');	//Calling arrow scrolling to be hidden
                        ///initArrow('contentTop');	//Calling top arrow scrolling to be hidden
                        simpleTopVar = "showPro";
                        var firstProduct;
                        var i = params.indexOf('y')
                        i = i + 2
                        var d = params.indexOf('&', i);
                        var curr = d - i;
                        firstProduct = params.substr(i, curr);
                        var _fileURL;

                        if (resizeInfiniViewWithResolution == true) {
                            _fileURL = "http://" +
									window.location.host + '/cat_files/' + firstProduct + '/cat_img/resolution/index.htm';
                            SetSourceWithCommands(_fileURL);
                            currentCenterImage = _fileURL;
                        }
                        else {
                            _fileURL = "http://" + window.location.host + '/cat_files/' + firstProduct + '/cat_img/index.htm';
                            //SetSource(_fileURL);
                            currentCenterImage = _fileURL;
                        }

                        catloadChecker = "Done";
                        //	checkMainInterFace();
                        //myMainCategoryMoving();
                    }
                    else {
                        //document.getElementById("DIV_LIST").innerHTML=loadPagesImage;
                        document.getElementById("DIV_LIST").innerHTML = loadPagesImage;
                        SetSource("/loadingpage.html");
                    }
                }
            }
           // req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            req.send("");
        }
    }
    
}

function stackCatRander_wap(StactText)
{
	stactCatTemp_wap += "_" + StactText  ;
	stackCatLimit_wap(3,stactCatTemp_wap);
}

function stackCatLimit_wap(limit,str)
{
	var splitStactCatTemp_wap = str.split("_"); 
		if(splitStactCatTemp_wap.length > limit)
		{
				var stackCatLimits = (splitStactCatTemp_wap.length - limit); 	
				for(i=stackCatLimits;i<splitStactCatTemp_wap.length;i++)
				{
					//alert(splitStactCatTemp_wap[i])
				}
		}
}

var k = 0; 
var nData = ""
var tbl =	"";
function stackCategories_wap(str,sapr,c)
{
    if (GetUAgentMainScript() != '')
	{

		iPhonePathCat = str.split(sapr);
		var n = iPhonePathCat.length -1;

	//*******************************************************
		if(k < n)
		{
			k++; 
			if (iPhonePathCat[k].length > 20)
			{
				var txt = document.getElementById("stackText").innerText;
				var splitTxt = txt.split(">>")
				for(j=0;j<splitTxt.length-1;j++)
				{
					nData += "<td><a href='#' class='StackCategories_wap' onClick='alert('ss')' > >> " +splitTxt[j].substr(0,16).concat("...");+ "</a></td>";
				}
			}
			tbl = "<table><tr><td><img src='../images/cat_img/new/menu_arrow.gif' onClick='alert('sss');' /></td>"+ nData +"</tr></table>";
			//document.getElementById("stackText").innerHTML = tbl;
		}
	//******************************************************/	
		if (n > c)
		{
			var data =	"";	
			var tbl  = "";
			var j =	n - c;
			for(i=j;i<n;i++)
			{
			
				data += "<td  ><a href='#' class='StackCategories_wap' onClick='alert('f')' > >> " + iPhonePathCat[i].substr(0,14).concat("...");+ "</a></td>";
			}
				tbl = "<table><tr><td><img src='../images/cat_img/new/menu_arrow.gif'  onClick='iphoneSliderMenu_prevSlide('list','','','','root')' /></td>"+ data +"</tr></table>";
				//document.getElementById("stackText").innerHTML = tbl;
		}
	}
}

//****************** END IPHONE DEVELOPMENT BY ZEESAHAN - SLIDE MENU *******************************/



// STACK CATEGORIES UP LEVEL NAVIGATION FUNCTIONALITY. 
// IMPLIMENTED BY ZEESHAN 13-AUG-09
//------------------------------------------------------
function GO_UP() {

    if (document.getElementById('InfiniOffice1_InfiniOffice')) {
        document.getElementById('InfiniOffice1_InfiniOffice').contentWindow.document.getElementById('IFControl').contentWindow.Back();
        return;
    }

    if (GetUserAgent() != "") {
        relatedProductBarHide();
        stackcall();
        UnLoadCommands();
    }
    else {
        relatedProductBarHide();
        document.getElementById("leftbartable").style.visibility = 'visible';
        if (arguments.length > 0) {
            level = arguments[0];
        }
        switch (level) {

            case "Home":
                nullAllVar();
                activeLevelzero();
                //refresh();
                break;
            case 1:
                //alert("a");
                nullAllVar();
                activeLevelzero();
                parentStacking(StackCateCache);
                if (GetUserAgent() == "") {
                    //LoadChildren1(xType, xParams, x_Url);
                    //DisplayProductsInfiniMenu(GetValueFromString(xParams, "category"));
                    DisplayProductsInfiniMenu(CACHE_CATID);
                    SUB_CATEGORIES(CACHE_CATID)
                    
                }
                else {
                    LoadChildren1_wap(xType, xParams, x_Url);
                }


                break;
            case 2:
                //alert("b");
                nullAllVar();
                activeLevelzero();
                stackCat(stackParms[0]);
                if (GetUAgentMainScript() == "") {
                    ShowHideInnerLayoutNew(x2Params, x2_Url);
                    DisplayProductsInfiniMenu(GetValueFromString(x2Params, "category"));
                }
                else {
                    ShowHideInnerLayoutNew_wap(x2Params, x2_Url);
                }
                stackLevel = 1;

                break;
            case 3:
                //alert("c");
                nullAllVar();
                activeLevelzero();
                stackCat(stackParms[1]);
                if (GetUAgentMainScript() == "") {
                    ShowHideInnerLayoutNew(x2Params, x2_Url);
                    DisplayProductsInfiniMenu(GetValueFromString(x2Params, "category"));
                }
                else {
                    ShowHideInnerLayoutNew_wap(x2Params, x2_Url);
                }
                stackLevel = 2;

                break;
            case "MainPro":
                //alert("d");
                nullAllVar();
                activeLevelzero();
                parentStacking(StackCateCache);
                LoadChildren1_wap(xType, xParams, x_Url);
                break;
            case "SubPro":
                //alert("e");
















                stackCat(stackParms[0]);
                if (GetUAgentMainScript() == "") {
                    ShowHideInnerLayoutNew(x2Params, x2_Url);
                }
                else {
                    ShowHideInnerLayoutNew_wap(x2Params, x2_Url);
                    document.getElementById("leftbartable").style.visibility = 'visible';
                    document.getElementById("DIV_LIST").style.display = 'block';
                }
                stackLevel = 1;
                break;
            default:
                level = 1;
                break;
        }
    }
}


// END.

var StackSlider = {
	x:0,
	w:0,
	nx:0,
	Back:function(divID)
	{
		if(document.getElementById(divID).style.left == "")  { this.x = 0; }
		else {	this.x = parseInt(document.getElementById(divID).style.left); }
		if(  document.getElementById("stackText").offsetWidth > w)
		{
			var bx = document.getElementById("stackText").offsetWidth - w;
			nx = -bx;
			t1 = new Tween(document.getElementById(divID).style,'left',Tween.backEaseIn,this.x,-bx,.5,'px')
			t1.start()
		}
	},
	Next:function(divID)
	{
		var x = parseInt(document.getElementById(divID).style.left);
		if(x < 0)
		{

			t1 = new Tween(document.getElementById(divID).style,'left',Tween.backEaseIn,x,0,.5,'px')
			t1.start();
		}
		
	},
	ShowNavigation:function()
	{
		if(document.getElementById("stack_next") && document.getElementById("stack_back"))
		{
			document.getElementById("stack_next").style.display="block";
			document.getElementById("stack_back").style.display="block";
		}
	}, 
	LiquidWidth:function()
	{
		
		w = Math.round(document.body.offsetWidth *.87); // document.getElementById("stcTd").clientWidth;
		//document.getElementById("stcDiv").style.width = w + "px";
		/*window.onresize = function()
		{
			alert(document.body.offsetWidth *.87)
			document.getElementById("stcDiv").style.width = Math.round(document.body.offsetWidth *.87)+ "px";
			document.getElementById("nlc").style.width = Math.round(document.body.offsetWidth *.99) + "px";
			document.getElementById("list").style.width = Math.round(document.body.offsetWidth *.90) + "px";
			document.getElementById("div_list_dyn").style.width = Math.round(document.body.offsetWidth *.90) + "px";
			document.getElementById("div_list_dyn2").style.width = Math.round(document.body.offsetWidth *.90) + "px";
			
		}*/
	},
	
	Init:function()
	{
		//this.LiquidWidth();
	}
}
StackSlider.Init();
///*****
var e = "";
var c = "";
var cp = "";
var t = "";
var clr = "f3f3f3"
function setID_RegForm_Wap(id,fld)
{
		switch(fld.toUpperCase())
		{
			case "EMAIL" 	 : e = id; break;
			case "TELEPHONE" : t = id; break;
			case "PASS" 	 : p = id; break;
			case "CPASS" 	 : cp= id; break;
		}
}
function regFormBlur_wap(id,num)
{
var fld = document.getElementById(id); 
var img = document.getElementsByName("rAlert")[num];

	if(fld.value == "" )
	{
		fld.style.background=clr
		img.src="../wap_images/err.gif";
	}
	else
	{
		switch(id)
		{
			case e : 
					if(fld.value.indexOf("@") != -1 &&  document.getElementById(id).value.indexOf(".") != -1)
					{
						fld.style.background="ffffff"
						img.src="../wap_images/currect.gif";
					}
					else
					{
						
						fld.style.background=clr;
						img.src="../wap_images/err.gif";
					}
			break;
			case cp : 
				if(fld.value != "" && document.getElementById(id).value == document.getElementById(p).value)
				{
					fld.style.background="ffffff"
					img.src="../wap_images/currect.gif";
				}
				else
				{
					fld.style.background=clr
					img.src="../wap_images/err.gif";
				}
			break; 
			case t :
				if(isInteger(document.getElementById(id).value))
				{
					fld.style.background="ffffff"
					img.src="../wap_images/currect.gif";
				}
				else
				{
					fld.style.background=clr
					img.src="../wap_images/err.gif";
				}
			break;
			default: 
				fld.style.background="ffffff"
				img.src="../wap_images/currect.gif";
			break;
		}
	}
}

function isInteger(s)
{   var i;
    for (i = 0; i < s.length; i++)
    {   
        // Check that current character is number.
        var c = s.charAt(i);
        if (((c < "0") || (c > "9"))) return false;
    }
    // All characters are numbers.
    return true;
}
//******/


//****** Windows Mobile Functions ****** //

function LoadChildren1_WinCE(type, params, _URL) {
    //	myMainCategoryMoving();
    //hideWorkFlow();
    xType = type;
    xParams = params;
    x_Url = _URL;
    document.getElementById('DIV_LIST').style.display = 'block';
  //  document.getElementById('DIV_LIST').innerHTML = loadPagesImage;
    //	document.getElementById('DIV_LIST').style.height = 260;
    if ((_URL != "") && (_URL != "javascript:")) {
        document.getElementById("DIV_LIST").innerHTML = redirectURL;
        window.location = _URL;
    }
    else if (_URL == "javascript:") {
       // document.getElementById("DIV_LIST").style.display = 'block';
        //document.getElementById("leftbartable").style.top = topCategory;
        //document.getElementById("leftbartable").style.left = leftCategory;
        sldbox = 2;
        var xmlResult;
        var req = null;
        req = initXMLHTTPRequest();
        if (req) {
            //req.open("POST", "Catalog/NewProPageDis.aspx" + params + "&relatedpro=" + RelatedViewChkr, true);
            req.open("GET", "Catalog/NewProPageDis.aspx" + params + "&relatedpro=" + RelatedViewChkr + uAgent, true);
            req.onreadystatechange = function() {
                var ready = req.readyState;
                var data = null;
                if (ready == 4) {
                    xmlResult = req.responseText;
                    document.getElementById('DIV_LIST').innerHTML = "";
                    document.getElementById('DIV_LIST').innerHTML = xmlResult;
                }
                else {
                   document.getElementById('DIV_LIST').innerHTML = loadPagesImage;
                }
            }
           // req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
            req.send("");
        }
    }
}



SetDeviceUAgent();
function SetDeviceUAgent() {

    if (navigator.userAgent.indexOf('iPhone') > 0) {
        uAgent = "&iphone=true";
    } else if (navigator.userAgent.indexOf('MSIE') > 0) {
        uAgent = "&MSIE=true";
    }
    else {
        uAgent = "";
    }
}







function SearchProductAtInfiniView(txt) {
	var textboxValue = document.getElementById("ProductSearch1_searchtxt").value;
    if (document.location.href.toLowerCase().indexOf("ajax/home.aspx")!= -1) {
         GOTO("/Default.aspx?SK=" + textboxValue);
        return;
    }

   
    var InfiniView = document.getElementById("frame_details");
    InfiniView.src = "../loadingpage.html"
    var CommandBar = GlobalObject("ACTIVECOMMANDS");

    if (CommandBar.style.visibility == "visible" ) {
        CommandBar.style.display = 'none';
    }
    
   // RestoreScreenWindow('');
	hideWorkFlow();
	//FrameSize('');
	//hideFavRight();
	//hideHistoryRight();

	//document.getElementById("DIV_LIST").innerHTML = "<table width='100%' height='200' border='0' cellpadding='0' cellspacing='0'><tr><td align='center' valign='bottom' class='favheadertext'>Searching..</td></tr><tr><td align='center' valign='top'>"+loadPagesImageCenter+"</td></tr></table>";
	
	//myMainCategoryMoving();
	//slidebox('slidebox1');
	//textbar('textbarcol'); 
	//relatedProductBarHide();
	//stop();

	if (txt) {
	    textboxValue = txt;
	}
	var xmlResult;
	var iChars = "!@#$%^*()+=<-[]\\\`~';,./{}|\":>&?";


	for (var i = 0; i < textboxValue.length; i++)
	{
	    if (iChars.indexOf(textboxValue.charAt(i)) != -1) 
	{
	textboxValue = "error"
	var queryString = "?ProductSearch=" + textboxValue;
	var queryString = "?ProductSearch=" + textboxValue;
	InfiniView.src = "AJAX/ProductDisplayAtInfiniView.aspx" + queryString;
	
	}
	}
	if(document.getElementById("ProductSearch1_searchtxt").value == "")
	{
	    var queryString = "?ProductSearch=" + document.getElementById("ProductSearch1_searchtxt").value;
	    var queryString = "?ProductSearch=" + textboxValue;
	    InfiniView.src = "AJAX/ProductDisplayAtInfiniView.aspx" + queryString;
	}
	else if(document.getElementById("ProductSearch1_searchtxt").value != "")
	{

	    textboxValue = document.getElementById("ProductSearch1_searchtxt").value;
	    
	    
	    var req = null;
	    req = initXMLHTTPRequest();
	    if (req) {
	        //req.open("POST", "Catalog/NewProPageDis.aspx" + params + "&relatedpro=" + RelatedViewChkr , true);
	        var queryString = "?ProductSearch=" + textboxValue;
	        req.open("GET", "AJAX/ProductDisplayAtInfiniView.aspx" + queryString ,true );
	        req.onreadystatechange = function() {
	            var ready = req.readyState;
	            if (ready == 4) {
	                var queryString = "?ProductSearch=" + textboxValue;
	               
	                InfiniView.src = "AJAX/ProductDisplayAtInfiniView.aspx" + queryString;
	            }
	            else {
	                InfiniView.src = "../loadingpage.html"
	            }
	        }
	        //req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	        req.send();
	    }
	}
	AutoResizeIFrame('frame_details', '100%');

}

function GlobalObject(objID) {
    if (document.getElementById(objID)) {
        return document.getElementById(objID);
    }
    if (parent.document.getElementById(objID)) {
        return parent.document.getElementById(objID);
    }
}
function GetUAgentMainScript() {
    var UserAgnt = navigator.userAgent.toLowerCase();
    var re = new RegExp("webkit/[5-9]|iemobile/[7-9]");
    if (UserAgnt.indexOf('iphone') >= 0) {
        return "iPhone";
    }
    else if (UserAgnt.indexOf('android') >= 0) {
        return "android";
    }
    //else if (UserAgnt.indexOf('blackberry') > 0 && UserAgnt.indexOf('applewebkit')) {
    else if (UserAgnt.indexOf('blackberry') >= 0 && UserAgnt.match(re)) {
        return "iPhone";
    }
    else if (UserAgnt.indexOf('symbianos/') >= 0 && UserAgnt.match(re)) {
        return "iPhone";
    }
    else if (UserAgnt.indexOf('msie') >= 0 && UserAgnt.match(re)) {
        return "iPhone"
    }
    else if (UserAgnt.indexOf('cfnetwork') >= 0 || UserAgnt.indexOf('darwin') >= 0) {
        return "iPhone";
    }
    else {
        return "";
    }
}
var oldCatID = null;
var oldRowID= null;
function CategoryMouseOutRestoreColor(CurrentCatID, rowID) {
    if (oldCatID != CurrentCatID && oldCatID != null ) {
        rowProbkgdOut(oldRowID);
        hyperLinkColorOut(oldCatID);
    }
    oldCatID = CurrentCatID;
    oldRowID = rowID;
 }

function GetValueFromString(URLQuery, paramname) {
    var query_new = URLQuery;
    var vars = query_new.split("&");
    for (var i = 0; i < vars.length; i++) {
        var pair = vars[i].split("=");
        if (pair[0].toLowerCase() == paramname) {
            if (pair[1] != 'undefined') {
                return pair[1];
            }
        }
    }
}
function SignoutConformationbox() {
    var UserAgnt = navigator.userAgent.toLowerCase();
    var re = new RegExp("webkit/[5-9]|iemobile/[7-9]");
    if (UserAgnt.indexOf('msie') >= 0 && UserAgnt.match(re)) {
        var URL = window.location.protocol + "//" + window.location.host + "/Customer/signout.aspx";
        window.location = URL;
     }
    else {
        var answer = confirm("Are you sure you want to signout?");
        if (answer) {
            var URL = window.location.protocol + "//" + window.location.host + "/Customer/signout.aspx";
            window.location = URL;
        }
    }
 }
 function isIPhoneApp() {
     var usrAgnt = navigator.userAgent.toLowerCase();
     if ((usrAgnt.indexOf('iphone') >= 0) && !(usrAgnt.indexOf('safari') >= 0)) {
         return true;
     }
 }

 var xmlHttp;
 var childid;
 var lengthc;
 var status;

 //var requestURL = 'https://' + window.location.host  + '/cam/service/ChildRecords.aspx?rid=';


 var is_ie = (navigator.userAgent.indexOf('MSIE') >= 0) ? 1 : 0;
 var is_ie5 = (navigator.appVersion.indexOf("MSIE 5.5") != -1) ? 1 : 0;
 var is_opera = ((navigator.userAgent.indexOf("Opera6") != -1) || (navigator.userAgent.indexOf("Opera/6") != -1)) ? 1 : 0;
 //netscape, safari, mozilla behave the same???
 var is_netscape = (navigator.userAgent.indexOf('Netscape') >= 0) ? 1 : 0;

 function getChildBalanceSheet(str1) {
     //alert(requestURL);

     var str = document.getElementById(str1);
     //alert(str.id);
     //str = str.trim();
     //alert(document.getElementById(str).value);
     var divQCproducts = document.getElementById("toplayerlayer2");
     if (!str.value == '') {
         var req = null;
         req = initXMLHTTPRequest();
         if (req) {
             //req.open("POST", "Catalog/NewProPageDis.aspx" + params + "&relatedpro=" + RelatedViewChkr , true);
             req.open("GET", "../Customer/GetRelatedBusiness.aspx?q=" + str.value, true);
             req.onreadystatechange = function() {
                 var ready = req.readyState;
                 if (ready == 4) {
                     if (req.responseText != '') {
                         overlay(str, 'toplayerlayer2', 'leftbottom');
                         divQCproducts.style.display = "block";
                         var newDiv = document.createElement('div');
                         newDiv.innerHTML = req.responseText; //xmlReq.responseText;
                         //alert(xmlResult);
                         divQCproducts.innerHTML = ''; //xmlResult;
                         divQCproducts.appendChild(newDiv);
                     }
                     else {
                         divQCproducts.style.display = "none";
                     }
                 }
                 else {

                 }
             }
             //req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
             req.send();
         }
     }
     else {
         //var divQCproducts = document.getElementById("toplayerlayer2");
         divQCproducts.style.display = "none";
     }
 }

 //function QCDoCallback(url, params) {
 //    var pageUrl = url + params;
 //    var xmlRequest;
 //    
 //    try {
 //        // Firefox, Opera 8.0+, Safari  
 //        xmlRequest = new XMLHttpRequest();
 //    }
 //    catch (e) {
 //        // Internet Explorer  
 //        try {
 //            xmlRequest = new ActiveXObject("Msxml2.XMLHTTP");
 //        }
 //        catch (e) {
 //            try {
 //                xmlRequest = new ActiveXObject("Microsoft.XMLHTTP");
 //            }
 //            catch (e) {
 //                alert("Your browser does not support AJAX!");
 //                return false;
 //            }
 //        }
 //    }
 //    xmlRequest.open("POST", pageUrl, false);
 //    xmlRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
 //    xmlRequest.send("");
 //    return xmlRequest;
 //}
 function setvalue(e, lstMyList) {
     //alert(lstMyList.id);
     if (!e) e = window.event;
     var selectName;


     if (e.keyCode) {
         switch (e.keyCode) {

             case 0:
                 //alert('case 0');
                 //case 13:
                 break;
             case 37:
                 break;
             case 38:
                 break;
             case 39:
                 break;
             case 40:
                 break;
             case 9: try {
                     for (i = 0; i < lstMyList.length; i++) {
                         if (lstMyList.options[i].selected) {
                             if (document.getElementById('RegistrationForm1_BusinessDescription')) {
                                 document.getElementById('RegistrationForm1_BusinessDescription').value = lstMyList.options[i].value;
                             }
                             else if (document.getElementById('Customer_Register_ShortWeb1_BusinessDescription')) {
                                 document.getElementById('Customer_Register_ShortWeb1_BusinessDescription').value = lstMyList.options[i].value;
                             }
                         }
                     }
                     document.getElementById("toplayerlayer2").innerHTML = "";
                     document.getElementById("toplayerlayer2").style.display = "none";
                     if (document.getElementById('RegistrationForm1_cart_customer_pass')) {
                         document.getElementById('RegistrationForm1_cart_customer_pass').focus();
                     }
                     else if (document.getElementById('Customer_Register_ShortWeb1_cart_customer_pass')) {
                         document.getElementById('Customer_Register_ShortWeb1_cart_customer_pass').focus();
                     }
                 }
                 catch (e) {
                 }
                 break;

             case 13: try {
                     for (i = 0; i < lstMyList.length; i++) {
                         if (lstMyList.options[i].selected) {
                             if (document.getElementById('RegistrationForm1_BusinessDescription')) {
                                 document.getElementById('RegistrationForm1_BusinessDescription').value = lstMyList.options[i].value;
                             }
                             else if (document.getElementById('Customer_Register_ShortWeb1_BusinessDescription')) {
                                 document.getElementById('Customer_Register_ShortWeb1_BusinessDescription').value = lstMyList.options[i].value;
                             }
                         }
                     }
                     document.getElementById("toplayerlayer2").innerHTML = "";
                     document.getElementById("toplayerlayer2").style.display = "none";
                     if (document.getElementById('RegistrationForm1_cart_customer_pass')) {
                         document.getElementById('RegistrationForm1_cart_customer_pass').focus();
                     }
                     else if (document.getElementById('Customer_Register_ShortWeb1_cart_customer_pass')) {
                         document.getElementById('Customer_Register_ShortWeb1_cart_customer_pass').focus();
                     }
                 }
                 catch (e) {
                 }
                 break;
             default:
                 //alert(e.keyCode);
                 break;
         }
         //var hh = alphaa.charCodeAt(0);
         //    var hh = e.keyCode;
         //    if ((hh > 47 && hh < 58) || (hh > 64 && hh < 91) || (hh > 96 && hh < 123)) {
         //    }


         //        try {

         //            for (i = 0; i < lstMyList.length; i++) {
         //                if (lstMyList.options[i].selected) {                    
         //                    document.getElementById('RegistrationForm1_BusinessDescription').value = lstMyList.options[i].value;
         //                }
         //            }

         //        }
         //        catch (e) {
         //        }
     }
     else if (e.which) {
         if (e.which <= 1) {
             try {

                 for (i = 0; i < lstMyList.length; i++) {
                     if (lstMyList.options[i].selected) {
                         //alert('it is here in selected part');
                         if (document.getElementById('RegistrationForm1_BusinessDescription')) {
                             document.getElementById('RegistrationForm1_BusinessDescription').value = lstMyList.options[i].value;
                         }
                         else if (document.getElementById('Customer_Register_ShortWeb1_BusinessDescription')) {
                             document.getElementById('Customer_Register_ShortWeb1_BusinessDescription').value = lstMyList.options[i].value;
                         }
                         document.getElementById("toplayerlayer2").style.display = "none";

                         if (document.getElementById('RegistrationForm1_cart_customer_pass')) {
                             document.getElementById('RegistrationForm1_cart_customer_pass').focus();
                         }
                         else if (document.getElementById('Customer_Register_ShortWeb1_cart_customer_pass')) {
                             document.getElementById('Customer_Register_ShortWeb1_cart_customer_pass').focus();
                         }
                     }
                 }



             }
             catch (e) {
             }
         }





     }

     else if (e.button) {
         //alert(e.button);
         if (e.button <= 1) {
             try {

                 for (i = 0; i < lstMyList.length; i++) {
                     if (lstMyList.options[i].selected) {
                         // alert('it is here in selected part');
                         if (document.getElementById('RegistrationForm1_BusinessDescription')) {
                             document.getElementById('RegistrationForm1_BusinessDescription').value = lstMyList.options[i].value;
                         }
                         else if (document.getElementById('Customer_Register_ShortWeb1_BusinessDescription')) {
                             document.getElementById('Customer_Register_ShortWeb1_BusinessDescription').value = lstMyList.options[i].value;
                         }
                         document.getElementById("toplayerlayer2").style.display = "none";

                         if (document.getElementById('RegistrationForm1_cart_customer_pass')) {
                             document.getElementById('RegistrationForm1_cart_customer_pass').focus();
                         }
                         else if (document.getElementById('Customer_Register_ShortWeb1_cart_customer_pass')) {
                             document.getElementById('Customer_Register_ShortWeb1_cart_customer_pass').focus();
                         }
                     }
                 }
             }
             catch (e) {
             }
         }


     }
 }

 function CursorKeyDown(e) {

     if (!e) e = window.event;
     var selectName;
     //alert(e.keyCode);
     switch (e.keyCode) {
         case 37:
             //    // Key left.
             //    selectName = leftName;
             break;
         case 38:
             //    // Key up.
             //    selectName = topName;
             break;
         case 39:
             //    // Key right.
             //    selectName = rightName;
             break;
         case 40:
             // Key down.
             //try 
             {
                 var controls = document.getElementById('GetRelatedBusiness1_RelatedBusiness');
                 //if (!controls) return;
                 //if (controls.length != 1) return;

                 controls.focus();
                 controls.hideFocus = false;
                 controls.options[0].selected = true;
                 //controls.options[0].focus() = true;
                 //setvalue(controls);
                 //controls[0].focus();
             }
             //          catch (e) {
             //          }

             break;
         default:
             //alert('it is here');
             //getChildBalanceSheet('RegistrationForm1_BusinessDescription');
             var hh = e.keyCode;
             //if ((hh > 47 && hh < 58) || (hh > 64 && hh < 91) || (hh > 96 && hh < 123))
             {

                if (document.getElementById('RegistrationForm1_BusinessDescription')) {
                     getChildBalanceSheet('RegistrationForm1_BusinessDescription');
                 }
                 else if (document.getElementById('Customer_Register_ShortWeb1_BusinessDescription')) {
                     getChildBalanceSheet('Customer_Register_ShortWeb1_BusinessDescription');
                 }

             }









             //setTimeout("getChildBalanceSheet('RegistrationForm1_BusinessDescription')", 1000);
             break;
     }

 }
 function HidebusinessDescription() {
     try {
         document.getElementById("toplayerlayer2").style.display = "none";
     }
     catch (e) { }
 }

 function overlay(curobj, subobjstr, opt_position) {
     if (document.getElementById) {
         var subobj = document.getElementById(subobjstr)
         subobj.style.display = "block";

         var xpos = getposOffset(curobj, "left") + ((typeof opt_position != "undefined" && opt_position.indexOf("right") != -1) ? -(subobj.offsetWidth - curobj.offsetWidth) : 0)
         var ypos = getposOffset(curobj, "top") + ((typeof opt_position != "undefined" && opt_position.indexOf("bottom") != -1) ? curobj.offsetHeight : 0)
         //var ypos = getposOffset(curobj, "top") ;  //((typeof opt_position != "undefined" && opt_position.indexOf("bottom") != -1) ? curobj.offsetHeight : 0)
         //subobj.style.left = (xpos - 250) + "px"

         subobj.style.left = (xpos + 15) + "px"
         subobj.style.top = (ypos + 5) + "px"

         return false
     }
     else
         return true
 }


 function getposOffset(overlay, offsettype) {
     var totaloffset = (offsettype == "left") ? overlay.offsetLeft : overlay.offsetTop;
     var parentEl = overlay.offsetParent;
     while (parentEl != null) {
         totaloffset = (offsettype == "left") ? totaloffset + parentEl.offsetLeft : totaloffset + parentEl.offsetTop;
         parentEl = parentEl.offsetParent;
     }
     return totaloffset;
 }

 function AddToCart(ProID, proName, proQueryURL) {

     var req = null;
     req = initXMLHTTPRequest();
     if (req) {
         var myDate = new Date();
         var myTime = myDate.getTime();
         req.open("GET", "../shopping/executecart.aspx?Productid=" + ProID + "&t=" + myTime, true);
         req.onreadystatechange = function() {
             var ready = req.readyState;
             if (ready == 4) {
                 var result = req.responseText;
                 if (result.toLowerCase() == "yes") {
                     //_ProductCommands = new ProductCommands(ProID);
                     //_ProductCommands.LoadWizard();

                     proClikedVar();
                     spaceRow();
                     totalPriceRemover();
                     downslide();
                     RelatedProduct(ProID);
                     //ShowHideProductCommands('Product', ProID, '?product_id=' + ProID + '&ProductCategory=', ProID, 'nosearch', proName);
                    // productQuerryURL(proQueryURL);
                     stop();

                 }
                 else {
                     //ShowCartButton();
                     document.getElementById('_CheckOut').style.display = "block";
                 }
                 parent.GetShopCount();
             }
         }
     }
     //req.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
     req.send("");

 }
 
  var MoveTo_CurrentState = 0;
  var MoveTo_Value = 0;
  var power = 250;
  var speed = 0.8;
 function MoveTo(objID, movePos) {
     try {
         var endPos = parseInt(GetElement("RelatedProMoveableDivContainer").style.width);
         var slidePos = GetElement(objID).offsetLeft;

         if (movePos.toLowerCase() == 'next') {
             if (Math.abs(slidePos) > 0) {
                 var t1 = new Tween(GetElement(objID).style, 'left', Tween.backEaseOut, MoveTo_CurrentState, (MoveTo_Value += power), speed, 'px')
                 t1.start();
             }

         } else if (movePos.toLowerCase() == 'back') {
             if (Math.abs(slidePos) <= (endPos/2)) {
                 var t1 = new Tween(GetElement(objID).style, 'left', Tween.backEaseOut, MoveTo_CurrentState, (MoveTo_Value -= power), speed, 'px')
                 t1.start();
              }
         }
        
         MoveTo_CurrentState = MoveTo_Value;

     } catch (ex) {
         alert("Function: MoveTo " + ex)
     }
 }
 function AthenaChatWindow() {
     var win = document.getElementById('cht');
     win.style.display = 'block';
     SetSupportFrameSource();
     var h = 9;
     var intID = setInterval(function() {
         if (win.offsetHeight <= 140) {
             h += 10;
             win.style.height = h;
         } else {
             clearInterval(intID);
         }

     }, 10)
 }
 window.onscroll = function() {
     var win = document.getElementById('cht');
     win.style.bottom = -document.body.scrollTop;
 }


 function AddCartAlert() {
     var e = GetElement("AddCartAlert");
     var i = setInterval(
        function() {
            alert(e.style.height);
            var h = parseInt(e.style.height) + 10;
            e.style.height += h;
            
            

        }, 1000)
    }

