/***************************************************/
//Getting the year for copyright. 
/***************************************************/
$(document).ready(function(){ 
        $(document).pngFix(); 
    }); 

function copyrightInfo()
{
	
	document.write("<p style='font-size:12px;margin:0px;'>Copyright &copy; 2008-2012, Global Delight Technologies Pvt. Ltd. All rights reserved.</p><p style='font-size:8px;margin-top:5px;  text-shadow: rgba(0,0,0,.0) 0 0px 0;'>Apple, the Apple logo, Mac, the Mac logo, iPod, iPod touch, iPhoto and iTunes are trademarks of Apple Inc., registered in the U.S. and other countries. iPhone is a trademark of Apple Inc. App Store is a service mark of Apple Inc.</p><br/><br/><br/>");
	document.write('<link rel="SHORTCUT ICON" HREF="images/favicon.ico">');
	
}

function iPhoneCopyright()
{
	document.write("Copyright &copy; 2008-2012, Global Delight Technologies Pvt. Ltd. All rights reserved.<br/><span style='font-size:9px;'> Apple, the Apple logo, iPod, iPod touch, and iTunes are trademarks of Apple Inc., registered in the U.S. and other countries. iPhone is a trademark of Apple Inc.  App Store is a service mark of Apple Inc.</span><br/><br/><br/>");
}

function pressnav2008()
{
	document.write('Archives: <a href="http://www.globaldelight.com/press/releases_2008.html" class="chosen">2008</a> | <a href="http://www.globaldelight.com/press/releases_2009.html">2009</a> | <a href="http://www.globaldelight.com/press/releases_2010.html" >2010</a> | <a href="http://www.globaldelight.com/press/releases_2011.html">2011</a> | <a href="http://www.globaldelight.com/press/releases_2012.html">2012</a>');
}
function pressnav2009()
{
	document.write('Archives: <a href="http://www.globaldelight.com/press/releases_2008.html">2008</a> | <a href="http://www.globaldelight.com/press/releases_2009.html" class="chosen">2009</a> | <a href="http://www.globaldelight.com/press/releases_2010.html" >2010</a> | <a href="http://www.globaldelight.com/press/releases_2011.html">2011</a> | <a href="http://www.globaldelight.com/press/releases_2012.html">2012</a>');
}
function pressnav2010()
{
	document.write('Archives: <a href="http://www.globaldelight.com/press/releases_2008.html">2008</a> | <a href="http://www.globaldelight.com/press/releases_2009.html">2009</a> | <a href="http://www.globaldelight.com/press/releases_2010.html" class="chosen" >2010</a> | <a href="http://www.globaldelight.com/press/releases_2011.html">2011</a> | <a href="http://www.globaldelight.com/press/releases_2012.html">2012</a>');
}
function pressnav2011()
{
	document.write('Archives: <a href="http://www.globaldelight.com/press/releases_2008.html">2008</a> | <a href="http://www.globaldelight.com/press/releases_2009.html">2009</a> | <a href="http://www.globaldelight.com/press/releases_2010.html" >2010</a> | <a href="http://www.globaldelight.com/press/releases_2011.html" class="chosen">2011</a> | <a href="http://www.globaldelight.com/press/releases_2012.html">2012</a>');
}

function pressnav2012()
{
	document.write('Archives: <a href="http://www.globaldelight.com/press/releases_2008.html">2008</a> | <a href="http://www.globaldelight.com/press/releases_2009.html">2009</a> | <a href="http://www.globaldelight.com/press/releases_2010.html" >2010</a> | <a href="http://www.globaldelight.com/press/releases_2011.html">2011</a> | <a href="http://www.globaldelight.com/press/releases_2012.html" class="chosen">2012</a>');
}
/***************************************************/

/******ajax loading page

function ahah(url, target) {
  document.getElementById(target).innerHTML = ' Fetching data...';
  if (window.XMLHttpRequest) {
    req = new XMLHttpRequest();
  } else if (window.ActiveXObject) {
    req = new ActiveXObject("Microsoft.XMLHTTP");
  }
  if (req != undefined) {
    req.onreadystatechange = function() {ahahDone(url, target);};
    req.open("GET", url, true);
    req.send("");
  }
}  

function ahahDone(url, target) {
  if (req.readyState == 4) { // only if req is "loaded"
    if (req.status == 200) { // only if "OK"
      document.getElementById(target).innerHTML = req.responseText;
    } else {
      document.getElementById(target).innerHTML=" AHAH Error:\n"+ req.status + "\n" +req.statusText;
    }
  }
}

function loadExtPage(name, div) {
	ahah(name,div);
	return false;
}

/*******************************/

//Checking for email ID

/*function checkemailId(name,val)
{
  	var regExpEmailId=/^[a-zA-Z][a-zA-Z0-9]*([_\.\-][a-zA-Z0-9]+)*@[a-zA-Z]+(\.[a-zA-Z]+)+$/;
    var subscribeVal=val
	var txtBoxName=name;
document.getElementById("phpresponse").innerHTML=' ';
if(document.getElementById(name).value=='')
{
  //alert("Please enter the  Email address");
  if(subscribeVal==1){
  document.getElementById("response").style.display="block";
  document.getElementById("phpresponse").innerHTML=' ';
  document.getElementById("response").innerHTML="Please enter the email address.";
  
  }
  else
  {
  document.getElementById("response1").style.display="block";
  document.getElementById("phpresponse").innerHTML=' ';
  document.getElementById("response1").innerHTML="Please enter the email address.";
 
  }
  document.getElementById(name).focus();
  return false;

}
 else if(!regExpEmailId.test(document.getElementById(name).value))
  {
  
  //alert("Please enter the valid Email address");
  if(subscribeVal==1)
  {
    document.getElementById("response").style.display="block";
	document.getElementById("phpresponse").innerHTML=' ';
    document.getElementById("response").innerHTML="Please enter a valid email address.";
	
	}
	else
	{
	  document.getElementById("response1").style.display="block";
	  document.getElementById("phpresponse").innerHTML=' ';
	  document.getElementById("response1").innerHTML="Please enter a valid email address.";
	
	}
  document.getElementById(name).focus();
  return false;
  }
}
*/
///*************************************

/********* app  info *********************/


function appinfo_getXmlHttp()
{
	var xmlhttp;
	if (window.XMLHttpRequest)
	{
		// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else if (window.ActiveXObject)
	{
		// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	else
	{
		alert("Your browser does not support XMLHTTP!");
	}
	
	return xmlhttp;
}

function appinfo_getByStub(stub, format)
{
	var xmlhttp = appinfo_getXmlHttp();
	
	document.write("<div id=\"appinfo-" + stub + "\"></div>");
	
	xmlhttp.onreadystatechange =	function()
									{
										if (xmlhttp.readyState == 4)
										{
											var elem = document.getElementById("appinfo-" + stub);
											elem.innerHTML = xmlhttp.responseText;
										}
									};
	
	xmlhttp.open("GET","/appinfo_server.php?stub=" + stub + "&format=" + format,true);
	xmlhttp.send(null);
}

function appinfo_getById(id, format)
{
	var xmlhttp = appinfo_getXmlHttp();
	
	document.write("<div id=\"appinfo-" + id + "\"></div>");

	xmlhttp.onreadystatechange =	function()
									{
										if (xmlhttp.readyState == 4)
										{
											var elem = document.getElementById("appinfo-" + id);
											elem.innerHTML = xmlhttp.responseText;
										}
									};
	xmlhttp.open("GET","/appinfo_server.php?id=" + id + "&format=" + format,true);
	xmlhttp.send(null);
}

function appinfo_getByUrl(url, format)
{
	var match = url.match(/id(\d{9})/);

	if (!match)
	{
		var match = url.match(/id=(\d{9})/);
		id = match[1];
	}

	id = match[1];

	appinfo_getById(id, format);
}

function appinfo_appshotshow(appleid, index)
{
	for (var i = 0; i < 100; i++)
	{
		var elem = document.getElementById("appshot_" + appleid + "_" + i);
		if (elem == null) break;
		
		if (i == index) elem.style.display = "inline";
		else elem.style.display = "none";
	}
	
	var caption = "Screenshot " + (index + 1) + " of " + i;
	elemcap = document.getElementById("appshotcaption_" + appleid);
	elemcap.innerHTML = caption;
}

function appinfo_appshotnext(appleid)
{
	var index = 0;
	
	for (var i = 0; i < 100; i++)
	{
		var elem = document.getElementById("appshot_" + appleid + "_" + i);
		if (elem == null) break;
		
		if (elem.style.display == "inline") index = i;
	}
	
	if (++index == i) index = 0;

	appinfo_appshotshow(appleid,index);
}

function appinfo_appshotprev(appleid)
{
	var index = 0;
	
	for (var i = 0; i < 100; i++)
	{
		var elem = document.getElementById("appshot_" + appleid + "_" + i);
		if (elem == null) break;
		
		if (elem.style.display == "inline") index = i;
	}
	
	if (--index == -1) index = i - 1;
	
	appinfo_appshotshow(appleid,index);
}

function appinfo_voter_mouseover(appleid, rating)
{
	var elem = document.getElementById("app_" + appleid + "_button_rating");
	elem.originalClassname = elem.className;

	elem.className = "score s" + rating;
}

function appinfo_voter_mouseout(appleid)
{
	var elem = document.getElementById("app_" + appleid + "_button_rating");
	elem.className = elem.originalClassname;
}

function appinfo_appRate(appleid, rating)
{
	var elemButtonRate = document.getElementById("app_" + appleid + "_button_rating");
	
	var newClassName = "score s" + rating;
	
	if (newClassName == elemButtonRate.originalClassname)
	{
		elemButtonRate.originalClassname = "score s0";
		rating = "";
	}
	else
		elemButtonRate.originalClassname = newClassName;
	
	// record in database
	var xmlHttp = appinfo_getXmlHttp();
	xmlHttp.open("GET","/appinfo_appRateAjax.php?appleid=" + appleid + "&rating=" + rating, true);
	xmlHttp.send(null);
}

function showRatingLog(appleid, show)
{
	var elem = document.getElementById("app_" + appleid + "_ratingLog");
	elem.style.display = (show) ? "block" : "none";
}


/************ end of app info  **************/


/***************pngfix*******************/

(function($) {

jQuery.fn.pngFix = function(settings) {

	// Settings
	settings = jQuery.extend({
		blankgif: 'blank.gif'
	}, settings);

	var ie55 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 5.5") != -1);
	var ie6 = (navigator.appName == "Microsoft Internet Explorer" && parseInt(navigator.appVersion) == 4 && navigator.appVersion.indexOf("MSIE 6.0") != -1);

	if (jQuery.browser.msie && (ie55 || ie6)) {

		//fix images with png-source
		jQuery(this).find("img[src$=.png]").each(function() {

			jQuery(this).attr('width',jQuery(this).width());
			jQuery(this).attr('height',jQuery(this).height());

			var prevStyle = '';
			var strNewHTML = '';
			var imgId = (jQuery(this).attr('id')) ? 'id="' + jQuery(this).attr('id') + '" ' : '';
			var imgClass = (jQuery(this).attr('class')) ? 'class="' + jQuery(this).attr('class') + '" ' : '';
			var imgTitle = (jQuery(this).attr('title')) ? 'title="' + jQuery(this).attr('title') + '" ' : '';
			var imgAlt = (jQuery(this).attr('alt')) ? 'alt="' + jQuery(this).attr('alt') + '" ' : '';
			var imgAlign = (jQuery(this).attr('align')) ? 'float:' + jQuery(this).attr('align') + ';' : '';
			var imgHand = (jQuery(this).parent().attr('href')) ? 'cursor:hand;' : '';
			if (this.style.border) {
				prevStyle += 'border:'+this.style.border+';';
				this.style.border = '';
			}
			if (this.style.padding) {
				prevStyle += 'padding:'+this.style.padding+';';
				this.style.padding = '';
			}
			if (this.style.margin) {
				prevStyle += 'margin:'+this.style.margin+';';
				this.style.margin = '';
			}
			var imgStyle = (this.style.cssText);

			strNewHTML += '<span '+imgId+imgClass+imgTitle+imgAlt;
			strNewHTML += 'style="position:relative;white-space:pre-line;display:inline-block;background:transparent;'+imgAlign+imgHand;
			strNewHTML += 'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;';
			strNewHTML += 'filter:progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + jQuery(this).attr('src') + '\', sizingMethod=\'scale\');';
			strNewHTML += imgStyle+'"></span>';
			if (prevStyle != ''){
				strNewHTML = '<span style="position:relative;display:inline-block;'+prevStyle+imgHand+'width:' + jQuery(this).width() + 'px;' + 'height:' + jQuery(this).height() + 'px;'+'">' + strNewHTML + '</span>';
			}

			jQuery(this).hide();
			jQuery(this).after(strNewHTML);

		});

		// fix css background pngs
		jQuery(this).find("*").each(function(){
			var bgIMG = jQuery(this).css('background-image');
			if(bgIMG.indexOf(".png")!=-1){
				var iebg = bgIMG.split('url("')[1].split('")')[0];
				jQuery(this).css('background-image', 'none');
				jQuery(this).get(0).runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + iebg + "',sizingMethod='scale')";
			}
		});
		
		//fix input with png-source
		jQuery(this).find("input[src$=.png]").each(function() {
			var bgIMG = jQuery(this).attr('src');
			jQuery(this).get(0).runtimeStyle.filter = 'progid:DXImageTransform.Microsoft.AlphaImageLoader' + '(src=\'' + bgIMG + '\', sizingMethod=\'scale\');';
   		jQuery(this).attr('src', settings.blankgif)
		});
	
	}
	
	return jQuery;

};

})(jQuery);
