
var xmlHttp
function AddComment(id)
{
var elem = document.getElementById("feedback");
elem.style.display = elem.style.display == "none" ? "" : "none"		
document.frmAddComment.ArtId.value = id;
}

function show(msg_id,id,read)
{
	var elem = document.getElementById(msg_id);
	if (elem.style.display == "none") 
		elem.style.display = "";
	else
		{elem.style.display = "none";
		 if (read == "no") window.location.href = '?pType=mails';}
	Update(id);
}


function fillMe(id)
{
	if (id == 'fp')	
	 {
		document.frmSitePages.pageType.value = 'Home';
		document.frmSitePages.pagename.value = 'Home';
		document.getElementById('lblEmail').innerHTML = "";
		document.getElementById('trEmailId').style.display = 'none';		
		document.getElementById('trSubject').style.display = 'none';						
		document.getElementById('lblSkipTo').innerHTML = "<a href=javascript:fillMe('cp')>Skip</a>";
		document.getElementById('PageText').innerHTML = "<%=textForHome%>";
	 }
	else if (id == 'cp')	
	  {
		document.frmSitePages.pageType.value = 'Text';
		document.frmSitePages.pagename.value = 'Company profile';
		document.getElementById('lblEmail').innerHTML = "";
		document.getElementById('trEmailId').style.display = 'none';		
		document.getElementById('trSubject').style.display = 'none';
		document.getElementById('lblSkipTo').innerHTML = "<a href=javascript:fillMe('os')>Skip</a>";										
		document.getElementById('PageText').innerHTML = "<%=textForCompanyProfile%>";
	  }
	else if (id == 'os')	
	 {
		document.frmSitePages.pageType.value = 'Text';
		document.frmSitePages.pagename.value = 'Our services';
		document.getElementById('lblEmail').innerHTML = "";
		document.getElementById('trEmailId').style.display = 'none';		
		document.getElementById('trSubject').style.display = 'none';
		document.getElementById('lblSkipTo').innerHTML = "<a href=javascript:fillMe('cu')>Skip</a>";										
		document.getElementById('PageText').innerHTML = "<%=textForOurServices%>";
	 }
	else if (id == 'cu')	
	{
		document.frmSitePages.pageType.value = 'ContactUs';
		document.frmSitePages.pagename.value = 'Contact us';
		document.getElementById('lblEmail').innerHTML = "<input name=Email size=25 maxlength=150 required format=email label=Email>";
		document.getElementById('trEmailId').style.display = '';		
		document.getElementById('trSubject').style.display = '';
		document.getElementById('lblSkipTo').innerHTML = "<a href='?tId=5'>Skip</a>";																
		document.getElementById('PageText').innerHTML = "<%=textForContactUs%>";		
	}
}

function showPage(id,introId,base)
{
   if (id == 'pd')	
	{
		document.getElementById('trRegistrationDetails').style.display = '';
		document.getElementById('trTemplates').style.display = 'none';
		document.getElementById('tdIntroduction').style.display = 'none';
		document.getElementById('trSitePages').style.display = 'none';
	}
	else if(id == 'de')	
	{
		document.getElementById('trRegistrationDetails').style.display = 'none';
		document.getElementById('trTemplates').style.display = '';
		document.getElementById('tdIntroduction').style.display = 'none';
		document.getElementById('trSitePages').style.display = 'none';
						
	}
	else if(id == 'sp')	
	{
		document.getElementById('trRegistrationDetails').style.display = 'none';
		document.getElementById('trSitePages').style.display = '';
		document.getElementById('trTemplates').style.display = 'none';
		document.getElementById('tdIntroduction').style.display = 'none';
	}
	else if(id == 'cl')	
	{
		document.getElementById('trRegistrationDetails').style.display = 'none';
		document.getElementById('trSitePages').style.display = 'none';
		document.getElementById('trTemplates').style.display = 'none';
		document.getElementById('tdIntroduction').style.display = 'none';
	}
	else if(id == 'in')	
	{
		document.getElementById('trRegistrationDetails').style.display = 'none';
		document.getElementById('trTemplates').style.display = 'none';
		document.getElementById('trSitePages').style.display = 'none';		
		document.getElementById('tdIntroduction').style.display = '';
		if(introId != '') showIntroContent(introId,base);
	}
	
	getMenu();
}

function showIntroContent(id,base)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url= base + "introContent.asp";
url=url+"?Id="+id;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChangedIntroContent;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function createCSS(base,userId,design,pageId,username)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url= base + "makeCSSFile.asp";
url=url+"?userId="+userId;
url=url+"&design="+design;
url=url+"&pageId="+pageId;
url = url + "&username=" + username;
url = url + "&base=" + base;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChangedCSS;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChangedIntroContent() 
{ 
	if (xmlHttp.readyState==4) 
		document.getElementById("tdIntroduction").innerHTML=xmlHttp.responseText;
}

function stateChangedCSS() 
{ 
	if (xmlHttp.readyState==4) 
	 {
	   // alert(xmlHttp.responseText);
	 }
}

function changeForm(frm)
{
	document.forms['frmContent'].encoding ='multipart/form-data';
	alert(document.forms['frmContent'].encoding);
	return validate_form(frm);
}

function UpdateQnt(qnt,id,base)
{ 
getPrice();
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url= base + "UpdateQnt.asp";
url=url+"?pId="+id;
url=url+"&qnt="+qnt;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChangedQnt;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChangedQnt() 
{ 
	//if (xmlHttp.readyState==4) alert(xmlHttp.responseText);
		// window.location.href = 'showMails.asp?Result=view&queryId='+document.getElementById("Id").value;
}

function showContent(str)
{ 
xmlHttp=GetXmlHttpObject();
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="index.asp";
url=url+"?queryId="+str;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged;
xmlHttp.open("GET",url,true);
xmlHttp.send(null);
}

function stateChanged() 
{ 

if (xmlHttp.readyState==4)
	{
	var text = xmlHttp.responseText;
	var pos = text.indexOf(',');
	var pos1 = text.indexOf('imgPath');
	var img = text.substring(0,pos);
	var cmt = text.substring(parseFloat(pos) + 1,pos1);
	var imgPath = text.substring(parseFloat(pos1) + 7);
	var sUrl = imgPath + "/" + img;
	var nWidth = document.getElementById("MaxWidthForFlash").value;
	var nHeight = document.getElementById("MaxHeightForFlash").value;
	if (nWidth == "") nWidth = 300;
	if (nHeight == "") nHeight = 250;
	
	if(img.substring(parseFloat(img.indexOf('.')) + 1) == 'swf')
		{
			document.getElementById("TRshowFlash").style.display = "";
			document.images["FullImage"].src = "";
			document.getElementById("TRshowImage").style.display = "none";
			fWriteFlashToObject("TDFlash", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" , sUrl, nWidth, nHeight, "#ffffff", false, "")
		}
	else
		{
		  document.images["FullImage"].src = "";
		  document.images["FullImage"].src = sUrl;
		  document.getElementById("TRshowFlash").style.display = "none";
		  document.getElementById("TRshowImage").style.display = "";
		}
	document.getElementById("TDshowText").style.display = "";
	document.getElementById("TDshowText").innerHTML = cmt;

	for (var i = 0; i < document.images.length; i++) {
	    imName = document.images[i].id;
	    if (imName.indexOf('galImg') == 0) {
	        document.images[i].setAttribute("className", "Thumb");
	        document.images[i].setAttribute("onmouseover", "ThumbOver");
	        document.images[i].setAttribute("onmouseout", "Thumb");
	    }
	}
	
	document.images("galImg" + img).setAttribute("className", "ThumbOver");
	document.images("galImg" + img).setAttribute("onmouseover", "ThumbOver") //onmouseover = "this.className='ThumbOver'"
	document.images("galImg" + img).setAttribute("onmouseout", "ThumbOver")  //onmouseout = "this.className='ThumbOver'"	
	}
}

function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP.5.0");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}

function fWriteFlashToObject(sObjName, sID, sUrl, nWidth, nHeight, sBG, bTransparent, sCssClass){
	var str=""
	str+='<object id="'+ sID +'" width="'+ nWidth +'" height="'+ nHeight +'" class="'+ sCssClass +'" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000">'
	str+='<param name="movie" value="'+ sUrl +'">'
	if(bTransparent) str+='<param name="wmode" value="transparent" />'
	str+='<param name="bgcolor" value="'+ sBG +'" />'
	str+='<param name="quality" value="high">'
	str+='<embed id="'+ sID +'" src="'+ sUrl +'" width="'+ nWidth +'" height="'+ nHeight +'" class="'+ sCssClass +'" bgcolor="'+ sBG +'" '+ (bTransparent ? 'wmode="transparent"' : '') +' quality="high"  TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></embed>'
	str+='</object>'

	document.getElementById(sObjName).innerHTML=str;
}
		
